fix: preserve requirement tree ordering for program courses#3053
Merged
fix: preserve requirement tree ordering for program courses#3053
Conversation
OpenAPI ChangesShow/hide No detectable change.Unexpected changes? Ensure your branch is up-to-date with |
125a7a6 to
82e885d
Compare
| .filter((node) => node.data.node_type === "operator") | ||
| .map((node) => { | ||
| const courseIds = extractCoursesFromNode(node) | ||
| const sectionCourses = (programCourses?.results || []).filter( |
Contributor
Author
There was a problem hiding this comment.
Before: use API order, filter by req_tree
Now: Use req_tree order, filter by existence in API results
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes course ordering in the program dashboard so program courses render in the same order as defined by the program requirement tree (req_tree), rather than the order returned by the courses API.
Changes:
- Update
ProgramEnrollmentDisplayto build section course lists by mapping requirement-tree course IDs to fetched courses. - Add a regression test to ensure the displayed course cards follow
req_treeordering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/EnrollmentDisplay.tsx | Rebuilds section course arrays using requirement-tree ID order instead of API list order. |
| frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/EnrollmentDisplay.test.tsx | Adds a test verifying UI course card order matches req_tree order. |
You can also share your feedback on Copilot code review. Take the survey.
Courses in ProgramEnrollmentDisplay were shown in API return order rather than the order defined in the program's requirement tree. Closes mitodl/hq#10528 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
82e885d to
937f31b
Compare
Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
feoh
pushed a commit
that referenced
this pull request
Mar 20, 2026
* fix: preserve requirement tree ordering for program courses Courses in ProgramEnrollmentDisplay were shown in API return order rather than the order defined in the program's requirement tree. Closes mitodl/hq#10528 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: use Map for coursesById lookup in program enrollment display Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Description (What does it do?)
Courses in
ProgramEnrollmentDisplaywere displayed in the order returned by the courses API rather than the order defined in the program's requirement tree (req_tree). This fix changes the logic to map over the requirement tree's course IDs and look up each course, preserving the intended ordering.How can this be tested?
include_in_learn_catalog: true/programs/READABLE_ID./dashboard, click on the program to go to its program dashboard, and observe that the courses are in the same order as specified in django adminreq_tree.