Skip to content

Release 0.41.2 #2445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release Notes
=============

Version 0.41.2
--------------

- Certificate page UI (#2429)
- Fix bad urls for edx video contentfiles (#2444)
- add program enrollments api and view program certificate button (#2439)

Version 0.41.1 (Released August 18, 2025)
--------------

Expand Down
44 changes: 44 additions & 0 deletions data_fixtures/migrations/0017_update_edx_content_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated manually


from django.db import migrations
from django.db.models import Value
from django.db.models.functions import Replace

from learning_resources.utils import content_files_loaded_actions


def update_contentfile_urls(apps, schema_editor):
"""
Update incorrect ContentFile URLs that use the "/jump_to/" format
"""

ContentFile = apps.get_model("learning_resources", "ContentFile")
LearningResourceRun = apps.get_model("learning_resources", "LearningResourceRun")
content_files = ContentFile.objects.filter(url__contains="/jump_to/").only(
"id", "url", "run__id"
)
# Get unique run IDs before updating
run_ids = set(content_files.values_list("run__id", flat=True).distinct())

# Update all ContentFile URLs in a single database query
content_files.update(url=Replace("url", Value("/jump_to/"), Value("/jump_to_id/")))

# Process the runs
for run in LearningResourceRun.objects.filter(id__in=run_ids):
content_files_loaded_actions(run)


class Migration(migrations.Migration):
dependencies = [
(
"data_fixtures",
"0016_add_canvas_platform",
),
]

operations = [
migrations.RunPython(
update_contentfile_urls, reverse_code=migrations.RunPython.noop
),
]
2 changes: 1 addition & 1 deletion frontends/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"ol-test-utilities": "0.0.0"
},
"dependencies": {
"@mitodl/mitxonline-api-axios": "2025.8.12",
"@mitodl/mitxonline-api-axios": "2025.8.18",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.6.3"
}
Expand Down
8 changes: 8 additions & 0 deletions frontends/api/src/mitxonline/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ProgramsApi,
ProgramCertificatesApi,
UsersApi,
ProgramEnrollmentsApi,
} from "@mitodl/mitxonline-api-axios/v2"
import axios from "axios"

Expand Down Expand Up @@ -51,10 +52,17 @@ const courseRunEnrollmentsApi = new EnrollmentsApi(
axiosInstance,
)

const programEnrollmentsApi = new ProgramEnrollmentsApi(
undefined,
BASE_PATH,
axiosInstance,
)

export {
usersApi,
b2bApi,
courseRunEnrollmentsApi,
programEnrollmentsApi,
programsApi,
programCollectionsApi,
coursesApi,
Expand Down
20 changes: 17 additions & 3 deletions frontends/api/src/mitxonline/hooks/enrollment/queries.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { queryOptions } from "@tanstack/react-query"
import type { CourseRunEnrollment } from "@mitodl/mitxonline-api-axios/v2"
import type {
CourseRunEnrollment,
UserProgramEnrollmentDetail,
} from "@mitodl/mitxonline-api-axios/v2"

import { courseRunEnrollmentsApi } from "../../clients"
import { courseRunEnrollmentsApi, programEnrollmentsApi } from "../../clients"
import { RawAxiosRequestConfig } from "axios"

const enrollmentKeys = {
root: ["mitxonline", "enrollments"],
Expand All @@ -10,10 +14,11 @@ const enrollmentKeys = {
"courseRunEnrollments",
"list",
],
programEnrollmentsList: () => [
programEnrollmentsList: (opts?: RawAxiosRequestConfig) => [
...enrollmentKeys.root,
"programEnrollments",
"list",
opts,
],
}

Expand All @@ -25,6 +30,15 @@ const enrollmentQueries = {
return courseRunEnrollmentsApi.enrollmentsList().then((res) => res.data)
},
}),
programEnrollmentsList: (opts?: RawAxiosRequestConfig) =>
queryOptions({
queryKey: enrollmentKeys.programEnrollmentsList(opts),
queryFn: async (): Promise<UserProgramEnrollmentDetail[]> => {
return programEnrollmentsApi
.programEnrollmentsList(opts)
.then((res) => res.data)
},
}),
}

export { enrollmentQueries, enrollmentKeys }
73 changes: 71 additions & 2 deletions frontends/api/src/mitxonline/test-utils/factories/courses.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,80 @@
import { mergeOverrides, makePaginatedFactory } from "ol-test-utilities"
import type { PartialFactory } from "ol-test-utilities"
import type { CourseWithCourseRunsSerializerV2 } from "@mitodl/mitxonline-api-axios/v2"
import type {
CourseWithCourseRunsSerializerV2,
V1CourseWithCourseRuns,
} from "@mitodl/mitxonline-api-axios/v2"
import { faker } from "@faker-js/faker/locale/en"
import { UniqueEnforcer } from "enforce-unique"

const uniqueCourseId = new UniqueEnforcer()
const uniqueCourseRunId = new UniqueEnforcer()

const v1Course: PartialFactory<V1CourseWithCourseRuns> = (overrides = {}) => {
const defaults: V1CourseWithCourseRuns = {
id: uniqueCourseId.enforce(() => faker.number.int()),
title: faker.lorem.words(3),
readable_id: faker.lorem.slug(),
next_run_id: faker.number.int(),
departments: [
{
name: faker.company.name(),
},
],
page: {
feature_image_src: faker.image.url(),
page_url: faker.internet.url(),
description: faker.lorem.paragraph(),
live: faker.datatype.boolean(),
length: `${faker.number.int({ min: 1, max: 12 })} weeks`,
effort: `${faker.number.int({ min: 1, max: 10 })} hours/week`,
financial_assistance_form_url: faker.internet.url(),
current_price: faker.number.int({ min: 0, max: 1000 }),
instructors: [
{
name: faker.person.fullName(),
bio: faker.lorem.paragraph(),
},
],
},
programs: null,
courseruns: [
{
id: uniqueCourseRunId.enforce(() => faker.number.int()),
title: faker.lorem.words(3),
start_date: faker.date.future().toISOString(),
end_date: faker.date.future().toISOString(),
enrollment_start: faker.date.past().toISOString(),
enrollment_end: faker.date.future().toISOString(),
expiration_date: faker.date.future().toISOString(),
courseware_url: faker.internet.url(),
courseware_id: faker.string.uuid(),
certificate_available_date: faker.date.future().toISOString(),
upgrade_deadline: faker.date.future().toISOString(),
is_upgradable: faker.datatype.boolean(),
is_enrollable: faker.datatype.boolean(),
is_archived: faker.datatype.boolean(),
is_self_paced: faker.datatype.boolean(),
run_tag: faker.lorem.word(),
live: faker.datatype.boolean(),
course_number: faker.lorem.word(),
products: [
{
id: faker.number.int(),
price: faker.commerce.price(),
description: faker.lorem.sentence(),
is_active: faker.datatype.boolean(),
product_flexible_price: null,
},
],
approved_flexible_price_exists: faker.datatype.boolean(),
},
],
}

return mergeOverrides<V1CourseWithCourseRuns>(defaults, overrides)
}

const course: PartialFactory<CourseWithCourseRunsSerializerV2> = (
overrides = {},
) => {
Expand Down Expand Up @@ -91,6 +159,7 @@ const course: PartialFactory<CourseWithCourseRunsSerializerV2> = (
return mergeOverrides<CourseWithCourseRunsSerializerV2>(defaults, overrides)
}

const v1Courses = makePaginatedFactory(v1Course)
const courses = makePaginatedFactory(course)

export { course, courses }
export { v1Course, v1Courses, course, courses }
51 changes: 50 additions & 1 deletion frontends/api/src/mitxonline/test-utils/factories/enrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import type { PartialFactory } from "ol-test-utilities"
import type {
CourseRunEnrollment,
CourseRunGrade,
UserProgramEnrollmentDetail,
} from "@mitodl/mitxonline-api-axios/v2"
import { UniqueEnforcer } from "enforce-unique"
import { factories } from ".."

const uniqueEnrollmentId = new UniqueEnforcer()
const uniqueRunId = new UniqueEnforcer()
Expand Down Expand Up @@ -99,9 +101,56 @@ const courseEnrollment: PartialFactory<CourseRunEnrollment> = (
return mergeOverrides<CourseRunEnrollment>(defaults, overrides)
}

const programEnrollment: PartialFactory<UserProgramEnrollmentDetail> = (
overrides = {},
): UserProgramEnrollmentDetail => {
const defaults: UserProgramEnrollmentDetail = {
certificate: faker.datatype.boolean()
? {
uuid: faker.string.uuid(),
link: faker.internet.url(),
}
: null,
program: {
id: faker.number.int(),
title: faker.lorem.words(3),
readable_id: faker.lorem.slug(),
courses: factories.courses.v1Course(),
requirements: {
required: [faker.number.int()],
electives: [faker.number.int()],
},
req_tree: [],
page: {
feature_image_src: faker.image.url(),
page_url: faker.internet.url(),
financial_assistance_form_url: faker.internet.url(),
description: faker.lorem.paragraph(),
live: faker.datatype.boolean(),
length: `${faker.number.int({ min: 1, max: 12 })} weeks`,
effort: `${faker.number.int({ min: 1, max: 10 })} hours/week`,
price: faker.commerce.price(),
},
program_type: faker.helpers.arrayElement([
"certificate",
"degree",
"diploma",
]),
departments: [
{
name: faker.company.name(),
},
],
live: faker.datatype.boolean(),
},
enrollments: [courseEnrollment()],
}
return mergeOverrides<UserProgramEnrollmentDetail>(defaults, overrides)
}

// Not paginated
const courseEnrollments = (count: number): CourseRunEnrollment[] => {
return new Array(count).fill(null).map(() => courseEnrollment())
}

export { courseEnrollment, courseEnrollments, grade }
export { courseEnrollment, courseEnrollments, grade, programEnrollment }
5 changes: 5 additions & 0 deletions frontends/api/src/mitxonline/test-utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const enrollment = {
`${API_BASE_URL}/api/v1/enrollments/${id ? `${id}/` : ""}`,
}

const programEnrollments = {
enrollmentsList: () => `${API_BASE_URL}/api/v1/program_enrollments/`,
}

const b2b = {
courseEnrollment: (readableId?: string) =>
`${API_BASE_URL}/api/v0/b2b/enroll/${readableId}/`,
Expand Down Expand Up @@ -59,4 +63,5 @@ export {
programCollections,
courses,
organization,
programEnrollments,
}
9 changes: 0 additions & 9 deletions frontends/main/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,7 @@ const nextConfig = {
images: {
remotePatterns: [
{
protocol: "http",
hostname: "**",
port: "",
pathname: "**",
},
{
protocol: "https",
hostname: "**",
port: "",
pathname: "**",
},
],
},
Expand Down
8 changes: 8 additions & 0 deletions frontends/main/public/images/certificate-badge-desktop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions frontends/main/public/images/certificate-badge-mobile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontends/main/public/images/mit-learn-logo-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading