Skip to content

fix: return certificate_available_date in courses list API response#38645

Open
Anas12091101 wants to merge 3 commits into
openedx:masterfrom
mitodl:anas/fix-certificate-available-date-api-issue
Open

fix: return certificate_available_date in courses list API response#38645
Anas12091101 wants to merge 3 commits into
openedx:masterfrom
mitodl:anas/fix-certificate-available-date-api-issue

Conversation

@Anas12091101
Copy link
Copy Markdown
Contributor

Description

The /api/courses/v1/courses/ list endpoint was not returning certificate_available_date even when set in Studio, because the field was only serialized in CourseDetailSerializer (detail endpoint).

This PR adds to_representation() to CourseSerializer so the field is included in list responses under the same condition: the certificates.auto_certificate_generation waffle 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:

  • Which edX user roles will this change impact? "Learner", "Course Author"
  • Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
  • Provide links to the description of corresponding configuration changes. Remember to correctly annotate these
    changes.

Supporting information

https://github.com/mitodl/hq/issues/11231

Testing instructions

Prerequisites: A running Open edX LMS with a course that has:

  • Pacing: Instructor-paced
  • Certificate display behavior: end_with_date
  • A certificate_available_date set

1. Enable the waffle switch

In Django admin (/admin/waffle/switch/), ensure certificates.auto_certificate_generation is active. Without it, the field is never included regardless of this change.

2. Hit the list endpoint

curl -H "Authorization: Bearer <token>" \
  "http://localhost:8000/api/courses/v1/courses/?course_keys=course-v1:OpenedX+DemoX+DemoCourse"

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

curl -H "Authorization: Bearer <token>" \
  "http://localhost:8000/api/courses/v1/courses/course-v1:OpenedX+DemoX+DemoCourse/"

Same field should appear there too (no regression).

5. Negative case — disable the waffle switch and confirm certificate_available_date is 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.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • If your database migration can't be rolled back easily.

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

Thanks for the pull request, @Anas12091101!

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.

@Anas12091101 Anas12091101 force-pushed the anas/fix-certificate-available-date-api-issue branch from 9bdf39a to fe11c46 Compare May 14, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants