Skip to content

feat: add exec ed course uuid to learner home serializer - #451

Merged
jono-booth merged 1 commit into
release-ulmofrom
jb/exec-ed-course-uuid
Sep 8, 2026
Merged

feat: add exec ed course uuid to learner home serializer#451
jono-booth merged 1 commit into
release-ulmofrom
jb/exec-ed-course-uuid

Conversation

@jono-booth

Copy link
Copy Markdown

Description

Adds a courseUuid field to the Learner Home CourseRunSerializer, resolved via the existing get_course_uuid_for_course() catalog utility (already used by common.djangoapps.entitlements)

Supporting information

  • Jira: ENT-9254 — EdX-ExecEd Dashboard redirect to OLC without stopping in Titan

Related changes in other repos:

  1. frontend-app-learner-dashboard: extends useCardExecEdTrackingParam to append courseUuid as a course_id query param on the "Start/Resume Course" link, alongside the existing org_id#26
  2. titan: reads that param in Spree::UsersControllerDecorator#show and redirects straight to the OLC instead of rendering the profile page, when it matches a course — #3903

This PR is safe to merge standalone — it only adds a new field to an existing API response; nothing consumes it yet.

Tests

Covered by lms/djangoapps/learner_home/test_serializers.py::TestCourseRunSerializer::test_with_data, which mocks the catalog call so courseUuid is populated, same treatment as every other field on this serializer.

Copilot AI lite review requested due to automatic review settings September 2, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Adding a per-enrollment Catalog UUID lookup in a high-traffic serializer can introduce N+1 external calls and noisy error-level logging when Catalog integration is disabled.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends the Learner Home API’s CourseRunSerializer to include a new courseUuid field, derived via the existing Catalog utility get_course_uuid_for_course(), and updates the serializer test to mock that Catalog lookup so the new field is populated during testing.

Changes:

  • Add courseUuid to CourseRunSerializer, resolved via openedx.core.djangoapps.catalog.utils.get_course_uuid_for_course().
  • Update TestCourseRunSerializer.test_with_data to mock the catalog call so courseUuid is non-null in the “all fields populated” test.
File summaries
File Description
lms/djangoapps/learner_home/serializers.py Adds courseUuid to the Learner Home course run payload, computed from Catalog.
lms/djangoapps/learner_home/test_serializers.py Mocks the catalog UUID lookup so the serializer test continues to assert all fields are populated.
Review details

Suppressed comments (1)

lms/djangoapps/learner_home/serializers.py:121

  • Calling get_course_uuid_for_course() here will emit an error-level log whenever CatalogIntegration is disabled (see check_catalog_integration_and_get_user()), and Learner Home can serialize many course runs per request. This can create noisy/error logs in deployments that don’t use the catalog service. Consider guarding the call behind a single integration-enabled check at request scope (and returning None silently when disabled) or adjusting the catalog utility’s logging behavior so “integration disabled” isn’t logged per serialized item.
    def get_courseUuid(self, instance):
        course_uuid = get_course_uuid_for_course(instance.course_id)
        return str(course_uuid) if course_uuid else None
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lms/djangoapps/learner_home/serializers.py Outdated
@jono-booth
jono-booth force-pushed the jb/exec-ed-course-uuid branch 3 times, most recently from 69a1d0a to 4aa20a7 Compare September 8, 2026 10:36

@brobro10000 brobro10000 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please regen the migration file with the Django command.

@jono-booth
jono-booth force-pushed the jb/exec-ed-course-uuid branch from 4aa20a7 to aa8a0ba Compare September 8, 2026 14:27
@jono-booth
jono-booth merged commit 2faa958 into release-ulmo Sep 8, 2026
64 checks passed
@jono-booth
jono-booth deleted the jb/exec-ed-course-uuid branch September 8, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants