feat: add hasUnmetPrerequisitesList in CoursewareAccessSerializer #37766
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.
Description
This pull request enhances the prerequisite course serialization in the learner home API by adding a new field that provides detailed information about unmet prerequisites. It introduces a new serializer method to return a list of prerequisite courses not yet completed, including their display names and URLs, and adds corresponding unit tests to ensure correct behavior.
Prerequisite course serialization improvements:
hasUnmetPrerequisitesListtoCoursewareAccessSerializer, which returns detailed info for each unmet prerequisite course, including display name, course home URL, and about page URL. [1] [2]_get_course_about_url_for_keyto reliably generate the course about page URL, handling cases where the course overview does not exist.Testing enhancements:
hasUnmetPrerequisitesListreturns an empty list when there are no unmet prerequisites and correctly serializes prerequisite course info when present.Dependency and import updates:
get_link_for_about_page,get_pre_requisite_courses_not_completed,CourseOverview) to support the new functionality.Supporting information
openedx/frontend-app-learner-dashboard#753
Testing instructions
/api/learner_home/initendpoint. Locate your created course and find the attributehasUnmetPrerequisitesList. You will see the following information:Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.