feat: error on funky multiple choice tags. (#288)

This change increases the frequency at which odd tags (like shuffle) on multiple choice problems don't go to the visual editor.
Instead, they will now divert to the advanced editor. There might be other places where we need to follow a similar pattern, but we don't know those yet.
This commit is contained in:
connorhaugh
2023-03-24 10:05:21 -04:00
committed by GitHub
parent 7ef1963327
commit 3bfa83220f
3 changed files with 36 additions and 0 deletions

View File

@@ -72,6 +72,10 @@ export class OLXParser {
const answers = [];
let data = {};
const widget = _.get(this.problem, `${problemType}.${widgetName}`);
const permissableTags = ['choice', '@_type', 'compoundhint', 'option', '#text'];
if (_.keys(widget).some((tag) => !permissableTags.includes(tag))) {
throw new Error('Misc Tags, reverting to Advanced Editor');
}
const choice = _.get(widget, option);
const isComplexAnswer = [ProblemTypeKeys.SINGLESELECT, ProblemTypeKeys.MULTISELECT].includes(problemType);
if (_.isEmpty(choice)) {