Abstract-tech: Fix: preserve ORA date_config_type through OLX export/import#2420
Abstract-tech: Fix: preserve ORA date_config_type through OLX export/import#2420ronakpansuriya wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @ronakpansuriya! 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. |
|
@ronakpansuriya Thank you for your contribution! @openedx/axim-engineering Pinging you since this repo is currently unmaintained. Could you please enable tests for this PR? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2420 +/- ##
==========================================
+ Coverage 95.45% 95.46% +0.01%
==========================================
Files 198 198
Lines 22755 22842 +87
Branches 1548 1551 +3
==========================================
+ Hits 21720 21807 +87
Misses 780 780
Partials 255 255
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@ronakpansuriya I notice there are some commit-lint failures. Please note that we use conventional commits across Open edX projects. You can read about the details here. Can you please amend your commit messages to follow our standard? |
ad795a3 to
19b1c13
Compare
|
Hi @e0d thanks for the review! I've updated the commit message to follow the Conventional Commits format. Could you please re-run the tests/lint check and let me know if anything else is missing? |
TL;DR - Fixes
date_config_type(ORA schedule mode: manual / match subsection/match course end) silently resetting to "manual" whenever a course is exported and re-imported.Issue: #2418
What changed?
openassessment/xblock/utils/xml.py--parse_from_xml()now reads thedate_config_typeattribute off the XML node (if present), validates it against the three known values (manual/subsection/course_end), and includes it in the returned config dict. RaisesUpdateFromXmlErroron an invalid value, same pattern as the other validated fields in this function.openassessment/xblock/utils/xml.py--serialize_content_to_xml()now writesdate_config_typeonto the XML node when it's set, following the sameif <field> is not None:pattern used for every other field here.openassessment/xblock/openassessmentblock.py--parse_xml()now assignsdate_config_typefrom the parsed config dict onto the block, falling back toDATE_CONFIG_MANUALwhen the value isNone(i.e. an old export from before this fix, or a course that never touched this setting). This fallback is intentional and important for backward compatibility: assigningNonedirectly would mark the field as explicitly set toNonein the XBlock field system instead of falling through to the class default, which would change behavior for every existing course that's never used this setting.TestDateConfigTypeXmltoopenassessment/xblock/test/test_xml.py-- covers reading a valid value, missing-attribute backward compatibility, invalid-value rejection, serialization, and a full parse -> serialize -> parse round trip.Testing Instructions
Automated:
pytest openassessment/xblock/test/test_xml.py -v
182 passed, 0 failed (177 pre-existing + 5 new, all in
TestDateConfigTypeXml).Manual, to reproduce the original bug and confirm the fix:
Before this fix: reverts to "Configure deadlines manually" with placeholder dates (2001-01-01 / 2099-12-31).
After this fix: correctly shows "Match deadlines to the subsection due date" selected.