Repository navigation
fix: restore Problem template behavior lost in the Mako to Django conversion - #368
irfanuddinahmad wants to merge 1 commit into
Conversation
…version Three regressions from openedx/openedx-platform#37570, which converted the capa templates from Mako to Django: - problem.html: the "Shift due dates" button wrapped the CTA's event data in quotes, so its onclick was a JS syntax error. Pass it to emit_event() unquoted, as the Mako template did. - choicetext.html: `value.my_id` looked up the literal key "my_id", so the numeric inputs of a choicetext problem came back blank. ChoiceTextGroup now puts each text input's saved answer in its content node's `value`. - choicegroup.html: the correctness mark used `choice_id in value`, a substring test for a radio choicegroup, so selecting choice_10 also marked choice_1; and a <radiogroup>'s list value never checked its radio. ChoiceGroup.selected_choice_ids() restores the Mako template's is_radio_input() rule for the checked, submitted and correctness marks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the pull request, @irfanuddinahmad! 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. |
Summary
Changes
problem.htmlpasses the event data toemit_event()unquoted, as the Mako template did (the fix suggested in #305)ChoiceGroup.selected_choice_ids()restores the Mako template's rule: a radio's string value is wrapped in a list, sochoice_id in selected_choice_idsis an exact match.choicegroup.htmluses it forsubmitted,checkedand the correctness mark. This also makes a<radiogroup>with a list valuecheckedagain.ChoiceTextGroupputs each text input's saved answer in its content node'svalue;choicetext.htmlreadscontent_node.valueTest plan
5 new tests fail on
mainand pass here:test_submit_disabled_cta_event_datatest_radio_label_marked_only_for_selected_choicetest_radiogroup_selected_choice_checkedtest_text_input_valuetest_saved_text_input_values, which renders end to end through the real template.ChoiceGroupTemplateTest.render_to_xmlandChoiceGroupTest.check_groupnow include the newselected_choice_idscontext key.pytest src/xblock_problem: 710 passed.ruff check,ruff format --checkandpylintare clean.Live in a local Tutor (platform master, xblocks-core 4.0.0 with this PR's four
capafiles on top; they're unchanged between 4.0.0 andmain), as a learner:choice_10(correct)choice_1andchoice_10marked correctchoice_10"Shift due dates": covered by the unit test only. A live check needs a self-paced course with personalized schedules and the learning MFE (see "Shift due dates" CTA under a past-due problem does nothing — onclick is invalid JavaScript #305).
Closes #305. Closes #367. Part of the Slash-n-Burn Built-In XBlocks epic.
🤖 Generated with Claude Code