Skip to content

fix: Fixes the enrollment counts for audit courses in Instructor Dashboard#38679

Merged
wgu-taylor-payne merged 2 commits into
openedx:masterfrom
WGU-Open-edX:fix/enrollment-track-visibility
Jun 2, 2026
Merged

fix: Fixes the enrollment counts for audit courses in Instructor Dashboard#38679
wgu-taylor-payne merged 2 commits into
openedx:masterfrom
WGU-Open-edX:fix/enrollment-track-visibility

Conversation

@brianjbuck-wgu
Copy link
Copy Markdown
Contributor

Description

Fixes a regression in the enrollment track visibility on the Course Info page of the Instructor Dashboard MFE.

In PR #38007, get_enrollment_counts() was refactored to only return modes explicitly configured via CourseMode.modes_for_course(). The intent was to show configured modes with 0 enrollments (e.g., a "professional" track with no learners yet). However, this inadvertently hid learners enrolled in modes that aren't explicitly configured, most notably the default "audit" track, which learners are placed into automatically but may not be listed as a configured course mode.

The result: the total count could be higher than the sum of the displayed mode counts, and entire enrollment tracks were invisible in the UI.

The fix returns the union of configured modes and modes with active enrollments, preserving both behaviors:

  1. Configured modes with 0 enrollments still appear (original intent of fix: optimize enrollment counts to use read replica and show all configured modes #38007)
  2. Modes with actual learners that aren't explicitly configured now appear as well (the bug fix)

Impacted roles: Course Author, Operator (Instructor Dashboard MFE consumers)

Supporting information

Testing instructions

  1. Create a course and configure only "honor" as a course mode (do NOT explicitly add "audit")
  2. Enroll learners; some will land in the default "audit" track
  3. Navigate to the Instructor Dashboard -> Course Info tab
  4. Both "honor" and "audit" appear, and the sum of all mode counts equals the total

Deadline

None

Other information

  • No database migrations required
  • No dependencies on other changes

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 1, 2026
@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Jun 1, 2026

Thanks for the pull request, @brianjbuck-wgu!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the instructor API v2 enrollment-count serialization to include enrollment modes that have active enrollments even when those modes aren’t explicitly configured for the course (addressing a dashboard regression).

Changes:

  • Expand get_enrollment_counts to add mode slugs present in enrollment counts but missing from course configuration.
  • Update the corresponding API v2 test to assert unconfigured-but-used modes (e.g., audit) appear and validate totals.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lms/djangoapps/instructor/views/serializers_v2.py Extends enrollment counts to include additional mode slugs found in actual enrollments.
lms/djangoapps/instructor/tests/test_api_v2.py Revises test expectations to cover unconfigured modes that still have enrollments and validates total consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lms/djangoapps/instructor/views/serializers_v2.py
Comment thread lms/djangoapps/instructor/tests/test_api_v2.py Outdated
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jun 1, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jun 1, 2026
@brianjbuck-wgu brianjbuck-wgu marked this pull request as ready for review June 1, 2026 23:09
@brianjbuck-wgu brianjbuck-wgu force-pushed the fix/enrollment-track-visibility branch from 76c3c2a to 6e65a47 Compare June 2, 2026 15:45
Copy link
Copy Markdown
Contributor

@wgu-taylor-payne wgu-taylor-payne left a comment

Choose a reason for hiding this comment

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

Looks good!

@wgu-taylor-payne wgu-taylor-payne merged commit 628c980 into openedx:master Jun 2, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting on Author to Done in Contributions Jun 2, 2026
@brianjbuck-wgu brianjbuck-wgu deleted the fix/enrollment-track-visibility branch June 2, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] Enrollment track visibility

5 participants