fix: return certificate_available_date in courses list API response#38645
fix: return certificate_available_date in courses list API response#38645Anas12091101 wants to merge 3 commits into
Conversation
|
Thanks for the pull request, @Anas12091101! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
9bdf39a to
fe11c46
Compare
Description
The /api/courses/v1/courses/ list endpoint was not returning
certificate_available_dateeven when set in Studio, because the field was only serialized inCourseDetailSerializer(detail endpoint).This PR adds
to_representation()to CourseSerializer so the field is included in list responses under the same condition: thecertificates.auto_certificate_generationwaffle switch is enabled and the course is instructor-paced.Also, this PR adds unit tests covering both the included and excluded cases.
Useful information to include:
changes.
Supporting information
https://github.com/mitodl/hq/issues/11231
Testing instructions
Prerequisites: A running Open edX LMS with a course that has:
end_with_datecertificate_available_dateset1. Enable the waffle switch
In Django admin (
/admin/waffle/switch/), ensurecertificates.auto_certificate_generationis active. Without it, the field is never included regardless of this change.2. Hit the list endpoint
3. Verify the response contains the field
{ "results": [ { "id": "course-v1:OpenedX+DemoX+DemoCourse", ... "certificate_available_date": "2026-05-27T00:00:00Z" } ] }4. Confirm the detail endpoint still works
Same field should appear there too (no regression).
5. Negative case — disable the waffle switch and confirm
certificate_available_dateis absent from both responses.Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Include anything else that will help reviewers and consumers understand the change.