-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Autoformat Problem XBlock Source Files for Consistency (2/3) #37487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
424f7c6 to
de9e343
Compare
b155f98 to
fb2e660
Compare
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
069382b to
ab72bf9
Compare
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
ab72bf9 to
85df359
Compare
|
Sandbox deployment successful 🚀 |
bda2c75 to
b574e9c
Compare
ee30435 to
0b84a2c
Compare
0b84a2c to
9209971
Compare
| }); | ||
|
|
||
| // split scripts and preformatted sections, and wrap paragraphs | ||
| splits = xml.split(/(<\/?(?:script|pre|label|description)[^>]*>)/gi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var answers; | ||
| answers = response.answers; | ||
| $.each(answers, function (key, value) { | ||
| var safeKey = key.replace(/\\/g, "\\\\").replace(/:/g, "\\:").replace(/\./g, "\\."); // fix for courses which use url_names with colons & periods, e.g. problem:question1, question1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var answer, choice, inputId, i, len, results, $element, $inputLabel, $inputStatus; | ||
| $element = $(element); | ||
| inputId = $element.attr("id").replace(/inputtype_/, ""); | ||
| var safeId = inputId.replace(/\\/g, "\\\\").replace(/:/g, "\\:").replace(/\./g, "\\."); // fix for courses which use url_names with colons & periods, e.g. problem:question1, question1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (!(src_escaped in loaded)) { | ||
| loaded[src_escaped] = true; | ||
| s = document.createElement("script"); | ||
| s.setAttribute("src", src_escaped); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment failed 💥 |
|
The PR looks good to me, I believe the fixes as you explained me will improve things. Please keep an eye on the logs after the merge. Few tests are pending once that will pass then you can merge it. |
salman2013
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…#37487) * fix: run prettier on problem block code * fix: codeql issues
This PR applies consistent formatting across all Problem XBlock–related files to align with the formatting conventions used in the
xblocks-contribextraction. The goal is to minimize noise during the extraction review and ensure that only functional differences remain when moving the Problem XBlock out ofedx-platform.We are in the process of extracting the Problem XBlock into
xblocks-contrib/problem, where all code and templates are already formatted consistently. To make the migration diff easier for reviewers—and to avoid unnecessary churn caused by formatting—we are pre-formatting the corresponding files insideedx-platformusing the same tools and configuration.Related PR: openedx/xblocks-contrib#63
#37476
HTML / Template Files
There's no known mako template formatter. so we will format html files after converting them to django templates.
JavaScript / CSS Files
YAML Files
prettier --write "xmodule/templates/problem/**/*.y?(a)ml"Testing:
partial_credit="EDC", selected a mix of right/wrong answers, and confirmed a partial score (e.g., 50%) was awarded.partial_credit="halves", selected one wrong option, and confirmed the score was cut exactly in half.inline="1"and confirmed the dropdown rendered inside the text flow, not on a new line.type="ci"(Case Insensitive), submitted"paris"for answer"Paris", and verified it was accepted.type="cs"(Case Sensitive), submitted"paris"for answer"Paris", and verified it was rejected.[1, 2]), submitted a value inside the range, and confirmed it was marked Correct.max_attemptsto 1, submitted an answer, and confirmed the Submit button disabled immediately.max_attemptsto 3, submitted incorrect answers, and confirmed the button remained enabled until the 3rd submission.max_attemptsto 0 (unlimited) and confirmed the problem never locks regardless of submissions.show_reset_button="true", clicked Reset on an un-submitted input, and confirmed the field cleared.show_reset_button="false"and confirmed the Reset button was hidden in the LMS.showanswer="always"and confirmed the Show Answer button was visible immediately upon page load.showanswer="answered"and confirmed the button appeared only after a correct submission.showanswer="attempted"and confirmed the button appeared after the first incorrect submission.showanswer="past_due", manipulated the due date to the past, and confirmed the button appeared immediately.rerandomize="on_reset"(on a problem with a Python script), clicked Reset, and confirmed the random values changed.rerandomize="never", clicked Reset, and confirmed that only inputs cleared while the random values remained static.shuffle="true"on a Multiple Choice problem, reloaded the page 3 times, and confirmed the order of answers changed.<choicehint>), then attempted to switch back to the Visual Editor to confirm the system prevented the action.1 + x^2forx^2 + 1), and confirmed the parser accepted it.During testing on the sandbox, the following problems were observed to be non-functional, but this is not caused by the changes in this PR
Relevant issue: #36538