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:
@@ -373,6 +373,24 @@ export class OLXParser {
|
||||
return problemType;
|
||||
}
|
||||
|
||||
getGeneralFeedback({ answers, problemType }) {
|
||||
/* Feedback is Generalized for a Problem IFF:
|
||||
1. The problem is of Types: Single Select or Dropdown.
|
||||
2. All the problem's incorrect, if Selected answers are equivalent strings, and there is no other feedback.
|
||||
*/
|
||||
if (problemType === ProblemTypeKeys.SINGLESELECT || problemType === ProblemTypeKeys.DROPDOWN) {
|
||||
const firstIncorrectAnswerText = answers.find(answer => answer.correct === false).selectedFeedback;
|
||||
const isAllIncorrectSelectedFeedbackTheSame = answers.every(answer => (answer.correct
|
||||
? true
|
||||
: answer?.selectedFeedback === firstIncorrectAnswerText
|
||||
));
|
||||
if (isAllIncorrectSelectedFeedbackTheSame) {
|
||||
return firstIncorrectAnswerText;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
getParsedOLXData() {
|
||||
if (_.isEmpty(this.problem)) {
|
||||
return {};
|
||||
@@ -410,7 +428,7 @@ export class OLXParser {
|
||||
// if problem is unset, return null
|
||||
return {};
|
||||
}
|
||||
|
||||
const generalFeedback = this.getGeneralFeedback({ answers: answersObject.answers, problemType });
|
||||
if (_.has(answersObject, 'additionalStringAttributes')) {
|
||||
additionalAttributes = { ...answersObject.additionalStringAttributes };
|
||||
}
|
||||
@@ -428,6 +446,7 @@ export class OLXParser {
|
||||
answers,
|
||||
problemType,
|
||||
additionalAttributes,
|
||||
generalFeedback,
|
||||
groupFeedbackList,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user