feat: Group, General Feedback Settings, Randomization

This Ticket adds three new settings widgets to the Problem Editor:
Randomization: This is a setting for advanced problems only which deals with python scripts.
General Feedback: This is feedback which is only applied to certain problem types for mass-adding feedback to incorrect problems.
Group Feedback: For certain problems, the user can provide specific feedback for a combination of specific answers.
This commit is contained in:
connorhaugh
2023-02-10 08:50:32 -05:00
committed by GitHub
parent 7c0309189f
commit d69d3e1ce7
32 changed files with 1303 additions and 22 deletions

View File

@@ -65,7 +65,21 @@ class ReactStateOLXParser {
const choice = [];
let compoundhint = [];
let widget = {};
const { answers } = this.problemState;
// eslint-disable-next-line prefer-const
let { answers, generalFeedback } = this.problemState;
// general feedback replaces selected feedback if all incorrect selected feedback is the same.
if (generalFeedback !== ''
&& answers.every(
answer => (
answer.correct
? true
: answer?.selectedFeedback === answers.find(a => a.correct === false).selectedFeedback
),
)) {
answers = answers.map(answer => (!answer?.correct
? { ...answer, selectedFeedback: generalFeedback }
: answer));
}
answers.forEach((answer) => {
const feedback = [];
let singleAnswer = {};