fix: handle empty certificate_available_date in schedule & details PUT#38456
fix: handle empty certificate_available_date in schedule & details PUT#38456Anas12091101 wants to merge 2 commits intoopenedx:masterfrom
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. |
d56670d to
683b43e
Compare
Description
When the
Certificate display behavioris set toImmediately upon passingorEnd date of courseand the Save button is clicked, the API returns a 400 error with the following response:The third option,
A date after the course end date, works correctly since it includes a date in the request payload.This was introduced by PR #38213: "feat: add AuthZ permissions for schedule and course details"), which added
certificate_available_dateto thedate_fieldsset in_classify_update. Unlike the other date fields (start_date,end_date, etc.), the MFE sendscertificate_available_date: ""(empty string) when no date is applicable. The existing guardif payload_value is not Nonedoes not cover empty strings, soDateTimeField.to_internal_value("")was called, raising a DRFValidationErrorthat propagated as a 400 response.This PR fixes this by normalizing empty string to
Nonefor date fields in_classify_updatebefore callingto_internal_value, since an empty string semantically means "no date". Additionally,allow_null=Truewas added to thecertificate_available_datefield inCourseDetailsSerializer, making it consistent withend_date,enrollment_end, andenrollment_start, all of which already allowed null.Useful information to include:
changes.
Supporting information
Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.
Testing instructions
. Go to the Schedule & Details page of an instructor-paced course.
2. Select
Immediately upon passingorEnd date of courseunder certificate display behavior.3. Click Save.
4. Verify that the change saves without any error
Deadline
"None"
Other information
Include anything else that will help reviewers and consumers understand the change.