Skip to content

Abstract-tech: Fix: preserve ORA date_config_type through OLX export/import#2420

Open
ronakpansuriya wants to merge 1 commit into
openedx:masterfrom
Abstract-Tech:fix/ora-date-config-type-xml
Open

Abstract-tech: Fix: preserve ORA date_config_type through OLX export/import#2420
ronakpansuriya wants to merge 1 commit into
openedx:masterfrom
Abstract-Tech:fix/ora-date-config-type-xml

Conversation

@ronakpansuriya

Copy link
Copy Markdown

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 the date_config_type attribute 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. Raises UpdateFromXmlError on an invalid value, same pattern as the other validated fields in this function.
  • openassessment/xblock/utils/xml.py -- serialize_content_to_xml() now writes date_config_type onto the XML node when it's set, following the same if <field> is not None: pattern used for every other field here.
  • openassessment/xblock/openassessmentblock.py -- parse_xml() now assigns date_config_type from the parsed config dict onto the block, falling back to DATE_CONFIG_MANUAL when the value is None (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: assigning None directly would mark the field as explicitly set to None in 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.
  • Added TestDateConfigTypeXml to openassessment/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:

  1. Create a course, add an ORA to a unit.
  2. Open the ORA's Schedule tab, select "Match deadlines to the subsection due date", save, publish.
  3. Studio -> Tools -> Export Course, download the tarball.
  4. Create a new, empty course. Studio -> Tools -> Import Course, upload the tarball from step 3.
  5. Open the ORA in the new course, go to the Schedule tab.

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 3, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @ronakpansuriya!

This repository is currently maintained by @openedx/openedx-unmaintained.

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.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jul 3, 2026
@itsjeyd itsjeyd moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Jul 13, 2026
@itsjeyd

itsjeyd commented Jul 13, 2026

Copy link
Copy Markdown

@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?

@itsjeyd itsjeyd added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.46%. Comparing base (95c188d) to head (ad795a3).
⚠️ Report is 1 commits behind head on master.

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              
Flag Coverage Δ
unittests 95.46% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@e0d

e0d commented Jul 13, 2026

Copy link
Copy Markdown

@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?

@e0d e0d moved this from Needs Tests Run or CLA Signed to Waiting on Author in Contributions Jul 13, 2026
@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 13, 2026
@ronakpansuriya
ronakpansuriya force-pushed the fix/ora-date-config-type-xml branch from ad795a3 to 19b1c13 Compare July 20, 2026 11:42
@ronakpansuriya

Copy link
Copy Markdown
Author

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?

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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

4 participants