feat:problem editor

Co-authored-by: Farhaan Bukhsh <farhaan@opencraft.com>
Co-authored-by: Navin Karkera <navin@disroot.org>
Co-authored-by: Kaustav Banerjee <kaustav@opencraft.com>
This commit is contained in:
connorhaugh
2022-12-20 14:52:20 -05:00
committed by GitHub
parent 6f82e87574
commit 8dea72de99
96 changed files with 58659 additions and 69792 deletions

View File

@@ -0,0 +1,397 @@
// Parse OLX to JavaScript objects.
/* eslint no-eval: 0 */
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
import _ from 'lodash-es';
import { ProblemTypeKeys } from '../../../data/constants/problem';
export const indexToLetterMap = [...Array(26)].map((val, i) => String.fromCharCode(i + 65));
export const nonQuestionKeys = [
'responseparam',
'formulaequationinput',
'correcthint',
'@_answer',
'optioninput',
'checkboxgroup',
'choicegroup',
'additional_answer',
'stringequalhint',
'textline',
'@_type',
'formulaequationinput',
'numericalresponse',
'demandhint',
];
export class OLXParser {
constructor(olxString) {
this.problem = {};
const options = {
ignoreAttributes: false,
alwaysCreateTextNode: true,
// preserveOrder: true
};
const parser = new XMLParser(options);
this.parsedOLX = parser.parse(olxString);
if (_.has(this.parsedOLX, 'problem')) {
this.problem = this.parsedOLX.problem;
}
}
parseMultipleChoiceAnswers(problemType, widgetName, option) {
const answers = [];
let data = {};
const widget = _.get(this.problem, `${problemType}.${widgetName}`);
const choice = _.get(widget, option);
if (_.isArray(choice)) {
choice.forEach((element, index) => {
const title = element['#text'];
const correct = eval(element['@_correct'].toLowerCase());
const id = indexToLetterMap[index];
const feedback = this.getAnswerFeedback(element, `${option}hint`);
answers.push(
{
id,
title,
correct,
...feedback,
},
);
});
} else {
const feedback = this.getAnswerFeedback(choice, `${option}hint`);
answers.push({
title: choice['#text'],
correct: eval(choice['@_correct'].toLowerCase()),
id: indexToLetterMap[answers.length],
...feedback,
});
}
data = { answers };
const groupFeedbackList = this.getGroupedFeedback(widget);
if (groupFeedbackList.length) {
data = {
...data,
groupFeedbackList,
};
}
return data;
}
getAnswerFeedback(choice, hintKey) {
let feedback = {};
let feedbackKeys = 'feedback';
if (_.has(choice, hintKey)) {
const answerFeedback = choice[hintKey];
if (_.isArray(answerFeedback)) {
answerFeedback.forEach((element) => {
if (_.has(element, '@_selected')) {
feedbackKeys = eval(element['@_selected'].toLowerCase()) ? 'selectedFeedback' : 'unselectedFeedback';
}
feedback = {
...feedback,
[feedbackKeys]: element['#text'],
};
});
} else {
if (_.has(answerFeedback, '@_selected')) {
feedbackKeys = eval(answerFeedback['@_selected'].toLowerCase()) ? 'selectedFeedback' : 'unselectedFeedback';
}
feedback = {
[feedbackKeys]: answerFeedback['#text'],
};
}
}
return feedback;
}
getGroupedFeedback(choices) {
const groupFeedback = [];
if (_.has(choices, 'compoundhint')) {
const groupFeedbackArray = choices.compoundhint;
if (_.isArray(groupFeedbackArray)) {
groupFeedbackArray.forEach((element) => {
groupFeedback.push({
id: groupFeedback.length,
answers: element['@_value'].split(' '),
feedback: element['#text'],
});
});
} else {
groupFeedback.push({
id: groupFeedback.length,
answers: groupFeedbackArray['@_value'].split(' '),
feedback: groupFeedbackArray['#text'],
});
}
}
return groupFeedback;
}
parseStringResponse() {
const { stringresponse } = this.problem;
const answers = [];
let answerFeedback = '';
let additionalStringAttributes = {};
let data = {};
const feedback = this.getFeedback(stringresponse);
answers.push({
id: indexToLetterMap[answers.length],
title: stringresponse['@_answer'],
correct: true,
feedback,
});
// Parsing additional_answer for string response.
const additionalAnswer = _.get(stringresponse, 'additional_answer', []);
if (_.isArray(additionalAnswer)) {
additionalAnswer.forEach((newAnswer) => {
answerFeedback = this.getFeedback(newAnswer);
answers.push({
id: indexToLetterMap[answers.length],
title: newAnswer['@_answer'],
correct: true,
feedback: answerFeedback,
});
});
} else {
answerFeedback = this.getFeedback(additionalAnswer);
answers.push({
id: indexToLetterMap[answers.length],
title: additionalAnswer['@_answer'],
correct: true,
feedback: answerFeedback,
});
}
// Parsing stringequalhint for string response.
const stringEqualHint = _.get(stringresponse, 'stringequalhint', []);
if (_.isArray(stringEqualHint)) {
stringEqualHint.forEach((newAnswer) => {
answers.push({
id: indexToLetterMap[answers.length],
title: newAnswer['@_answer'],
correct: false,
feedback: newAnswer['#text'],
});
});
} else {
answers.push({
id: indexToLetterMap[answers.length],
title: stringEqualHint['@_answer'],
correct: false,
feedback: stringEqualHint['#text'],
});
}
// TODO: Support multiple types.
additionalStringAttributes = {
type: _.get(stringresponse, '@_type'),
textline: {
size: _.get(stringresponse, 'textline.@_size'),
},
};
data = {
answers,
additionalStringAttributes,
};
return data;
}
parseNumericResponse() {
const { numericalresponse } = this.problem;
let answers = [];
let subAnswers = [];
let data = {};
// TODO: Find a way to add answers using additional_answers v/s numericalresponse
if (_.isArray(numericalresponse)) {
numericalresponse.forEach((numericalAnswer) => {
subAnswers = this.parseNumericResponseObject(numericalAnswer, answers.length);
answers = _.concat(answers, subAnswers);
});
} else {
subAnswers = this.parseNumericResponseObject(numericalresponse, answers.length);
answers = _.concat(answers, subAnswers);
}
data = {
answers,
};
return data;
}
parseNumericResponseObject(numericalresponse, answerOffset) {
let answerFeedback = '';
const answers = [];
let responseParam = {};
// TODO: UI needs to be added to support adding tolerence in numeric response.
const feedback = this.getFeedback(numericalresponse);
if (_.has(numericalresponse, 'responseparam')) {
const type = _.get(numericalresponse, 'responseparam.@_type');
const defaultValue = _.get(numericalresponse, 'responseparam.@_default');
responseParam = {
[type]: defaultValue,
};
}
answers.push({
id: indexToLetterMap[answers.length + answerOffset],
title: numericalresponse['@_answer'],
correct: true,
feedback,
...responseParam,
});
// Parsing additional_answer for numerical response.
const additionalAnswer = _.get(numericalresponse, 'additional_answer', []);
if (_.isArray(additionalAnswer)) {
additionalAnswer.forEach((newAnswer) => {
answerFeedback = this.getFeedback(newAnswer);
answers.push({
id: indexToLetterMap[answers.length + answerOffset],
title: newAnswer['@_answer'],
correct: true,
feedback: answerFeedback,
});
});
} else {
answerFeedback = this.getFeedback(additionalAnswer);
answers.push({
id: indexToLetterMap[answers.length + answerOffset],
title: additionalAnswer['@_answer'],
correct: true,
feedback: answerFeedback,
});
}
return answers;
}
parseQuestions(problemType) {
const builder = new XMLBuilder();
const problemObject = _.get(this.problem, problemType);
let questionObject = {};
/* TODO: How do we uniquely identify the label and description?
In order to parse label and description, there should be two states
and settings should be introduced to edit the label and description.
In turn editing the settings update the state and then it can be added to
the parsed OLX.
*/
const tagMap = {
label: 'bold',
description: 'em',
};
/* Only numerical response has different ways to generate OLX, test with
numericInputWithFeedbackAndHintsOLXException and numericInputWithFeedbackAndHintsOLX
shows the different ways the olx can be generated.
*/
if (_.isArray(problemObject)) {
questionObject = _.omitBy(problemObject[0], (value, key) => _.includes(nonQuestionKeys, key));
} else {
questionObject = _.omitBy(problemObject, (value, key) => _.includes(nonQuestionKeys, key));
}
// Check if problem tag itself will have question and descriptions.
if (_.isEmpty(questionObject)) {
questionObject = _.omitBy(this.problem, (value, key) => _.includes(nonQuestionKeys, key));
}
const serializedQuestion = _.mapKeys(questionObject, (value, key) => _.get(tagMap, key, key));
const questionString = builder.build(serializedQuestion);
return questionString;
}
getHints() {
const hintsObject = [];
if (_.has(this.problem, 'demandhint.hint')) {
const hint = _.get(this.problem, 'demandhint.hint');
if (_.isArray(hint)) {
hint.forEach(element => {
hintsObject.push({
id: hintsObject.length,
value: element['#text'],
});
});
} else {
hintsObject.push({
id: hintsObject.length,
value: hint['#text'],
});
}
}
return hintsObject;
}
getFeedback(xmlElement) {
return _.has(xmlElement, 'correcthint') ? _.get(xmlElement, 'correcthint.#text') : '';
}
getProblemType() {
const problemKeys = Object.keys(this.problem);
const intersectedProblems = _.intersection(Object.values(ProblemTypeKeys), problemKeys);
if (intersectedProblems.length > 1) {
const errorMessage = {
code: 500,
message: 'More than one problem type is not supported!',
};
throw errorMessage;
}
const problemType = intersectedProblems[0];
return problemType;
}
getParsedOLXData() {
if (_.isEmpty(this.problem)) {
return {};
}
let answersObject = {};
let additionalAttributes = {};
let groupFeedbackList = [];
const problemType = this.getProblemType();
const hints = this.getHints();
const question = this.parseQuestions(problemType);
const errorMessage = {
code: 500,
message: 'The problem type is not supported!',
};
switch (problemType) {
case ProblemTypeKeys.DROPDOWN:
answersObject = this.parseMultipleChoiceAnswers(ProblemTypeKeys.DROPDOWN, 'optioninput', 'option');
break;
case ProblemTypeKeys.TEXTINPUT:
answersObject = this.parseStringResponse();
break;
case ProblemTypeKeys.NUMERIC:
answersObject = this.parseNumericResponse();
break;
case ProblemTypeKeys.MULTISELECT:
answersObject = this.parseMultipleChoiceAnswers(ProblemTypeKeys.MULTISELECT, 'checkboxgroup', 'choice');
break;
case ProblemTypeKeys.SINGLESELECT:
answersObject = this.parseMultipleChoiceAnswers(ProblemTypeKeys.SINGLESELECT, 'choicegroup', 'choice');
break;
default:
throw errorMessage;
}
if (_.has(answersObject, 'additionalStringAttributes')) {
additionalAttributes = { ...answersObject.additionalStringAttributes };
}
if (_.has(answersObject, 'groupFeedbackList')) {
groupFeedbackList = answersObject.groupFeedbackList;
}
const { answers } = answersObject;
const settings = { hints };
return {
question,
settings,
answers,
problemType,
additionalAttributes,
groupFeedbackList,
};
}
}

View File

@@ -0,0 +1,138 @@
import { OLXParser } from './OLXParser';
import {
checkboxesOLXWithFeedbackAndHintsOLX,
dropdownOLXWithFeedbackAndHintsOLX,
numericInputWithFeedbackAndHintsOLX,
numericInputWithFeedbackAndHintsOLXException,
textInputWithFeedbackAndHintsOLX,
mutlipleChoiceWithFeedbackAndHintsOLX,
textInputWithFeedbackAndHintsOLXWithMultipleAnswers,
} from './mockData/olxTestData';
import { ProblemTypeKeys } from '../../../data/constants/problem';
describe('Check OLXParser problem type', () => {
test('Test checkbox with feedback and hints problem type', () => {
const olxparser = new OLXParser(checkboxesOLXWithFeedbackAndHintsOLX.rawOLX);
const problemType = olxparser.getProblemType();
expect(problemType).toBe(ProblemTypeKeys.MULTISELECT);
});
test('Test numeric problem type', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLX.rawOLX);
const problemType = olxparser.getProblemType();
expect(problemType).toBe(ProblemTypeKeys.NUMERIC);
});
test('Test dropdown with feedback and hints problem type', () => {
const olxparser = new OLXParser(dropdownOLXWithFeedbackAndHintsOLX.rawOLX);
const problemType = olxparser.getProblemType();
expect(problemType).toBe(ProblemTypeKeys.DROPDOWN);
});
test('Test multiple choice with feedback and hints problem type', () => {
const olxparser = new OLXParser(mutlipleChoiceWithFeedbackAndHintsOLX.rawOLX);
const problemType = olxparser.getProblemType();
expect(problemType).toBe(ProblemTypeKeys.SINGLESELECT);
});
test('Test textual problem type', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLX.rawOLX);
const problemType = olxparser.getProblemType();
expect(problemType).toBe(ProblemTypeKeys.TEXTINPUT);
});
});
describe('Check OLXParser hints', () => {
test('Test checkbox hints', () => {
const olxparser = new OLXParser(checkboxesOLXWithFeedbackAndHintsOLX.rawOLX);
const hints = olxparser.getHints();
expect(hints).toEqual(checkboxesOLXWithFeedbackAndHintsOLX.hints);
});
test('Test numeric hints', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLX.rawOLX);
const hints = olxparser.getHints();
expect(hints).toEqual(numericInputWithFeedbackAndHintsOLX.hints);
});
test('Test dropdown with feedback and hints problem type', () => {
const olxparser = new OLXParser(dropdownOLXWithFeedbackAndHintsOLX.rawOLX);
const hints = olxparser.getHints();
expect(hints).toEqual(dropdownOLXWithFeedbackAndHintsOLX.hints);
});
test('Test multiple choice with feedback and hints problem type', () => {
const olxparser = new OLXParser(mutlipleChoiceWithFeedbackAndHintsOLX.rawOLX);
const hints = olxparser.getHints();
expect(hints).toEqual(mutlipleChoiceWithFeedbackAndHintsOLX.hints);
});
test('Test textual problem type', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLX.rawOLX);
const hints = olxparser.getHints();
expect(hints).toEqual(textInputWithFeedbackAndHintsOLX.hints);
});
});
describe('Check OLXParser for answer parsing', () => {
test('Test checkbox answer', () => {
const olxparser = new OLXParser(checkboxesOLXWithFeedbackAndHintsOLX.rawOLX);
const answer = olxparser.parseMultipleChoiceAnswers('choiceresponse', 'checkboxgroup', 'choice');
expect(answer).toEqual(checkboxesOLXWithFeedbackAndHintsOLX.data);
});
test('Test dropdown answer', () => {
const olxparser = new OLXParser(dropdownOLXWithFeedbackAndHintsOLX.rawOLX);
const answer = olxparser.parseMultipleChoiceAnswers('optionresponse', 'optioninput', 'option');
expect(answer).toEqual(dropdownOLXWithFeedbackAndHintsOLX.data);
});
test('Test multiple choice single select', () => {
const olxparser = new OLXParser(mutlipleChoiceWithFeedbackAndHintsOLX.rawOLX);
const answer = olxparser.parseMultipleChoiceAnswers('multiplechoiceresponse', 'choicegroup', 'choice');
expect(answer).toEqual(mutlipleChoiceWithFeedbackAndHintsOLX.data);
});
test('Test string response answers', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLX.rawOLX);
const answer = olxparser.parseStringResponse();
expect(answer).toEqual(textInputWithFeedbackAndHintsOLX.data);
});
test('Test string response answers with multiple answers', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLXWithMultipleAnswers.rawOLX);
const answer = olxparser.parseStringResponse();
expect(answer).toEqual(textInputWithFeedbackAndHintsOLXWithMultipleAnswers.data);
});
test('Test numerical response answers', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLX.rawOLX);
const answer = olxparser.parseNumericResponse();
expect(answer).toEqual(numericInputWithFeedbackAndHintsOLX.data);
});
test('Test numerical response answers exception', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLXException.rawOLX);
const answer = olxparser.parseNumericResponse();
expect(answer).toEqual(numericInputWithFeedbackAndHintsOLXException.data);
});
});
describe('Check OLXParser for question parsing', () => {
test('Test checkbox question', () => {
const olxparser = new OLXParser(checkboxesOLXWithFeedbackAndHintsOLX.rawOLX);
const question = olxparser.parseQuestions('choiceresponse');
expect(question).toEqual(checkboxesOLXWithFeedbackAndHintsOLX.question);
});
test('Test dropdown question', () => {
const olxparser = new OLXParser(dropdownOLXWithFeedbackAndHintsOLX.rawOLX);
const question = olxparser.parseQuestions('optionresponse');
expect(question).toEqual(dropdownOLXWithFeedbackAndHintsOLX.question);
});
test('Test multiple choice single select question', () => {
const olxparser = new OLXParser(mutlipleChoiceWithFeedbackAndHintsOLX.rawOLX);
const question = olxparser.parseQuestions('multiplechoiceresponse');
expect(question).toEqual(mutlipleChoiceWithFeedbackAndHintsOLX.question);
});
test('Test string response question', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLX.rawOLX);
const question = olxparser.parseQuestions('stringresponse');
expect(question).toEqual(textInputWithFeedbackAndHintsOLX.question);
});
test('Test numerical response question', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLX.rawOLX);
const question = olxparser.parseQuestions('numericalresponse');
expect(question).toEqual(numericInputWithFeedbackAndHintsOLX.question);
});
test('Test numerical response question exception', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLXException.rawOLX);
const question = olxparser.parseQuestions('numericalresponse');
expect(question).toEqual(numericInputWithFeedbackAndHintsOLXException.question);
});
});

View File

@@ -0,0 +1,281 @@
import _ from 'lodash-es';
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
import { ProblemTypeKeys } from '../../../data/constants/problem';
class ReactStateOLXParser {
constructor(problemState) {
const parserOptions = {
ignoreAttributes: false,
alwaysCreateTextNode: true,
// preserveOrder: true
};
const builderOptions = {
ignoreAttributes: false,
attributeNamePrefix: '@_',
suppressBooleanAttributes: false,
format: true,
};
this.parser = new XMLParser(parserOptions);
this.builder = new XMLBuilder(builderOptions);
this.problemState = problemState.problem;
}
addHints() {
const hintsArray = [];
const hints = _.get(this.problemState, 'settings.hints', []);
hints.forEach(element => {
hintsArray.push({
'#text': element.value,
});
});
const demandhint = {
demandhint: {
hint: hintsArray,
},
};
return demandhint;
}
addMultiSelectAnswers(option) {
const choice = [];
let compoundhint = [];
let widget = {};
const { answers } = this.problemState;
answers.forEach((answer) => {
const feedback = [];
let singleAnswer = {};
if (this.hasAttributeWithValue(answer, 'title')) {
if (this.hasAttributeWithValue(answer, 'selectedFeedback')) {
feedback.push({
'#text': _.get(answer, 'selectedFeedback'),
'@_selected': true,
});
}
if (this.hasAttributeWithValue(answer, 'unselectedFeedback')) {
feedback.push({
'#text': _.get(answer, 'unselectedFeedback'),
'@_selected': false,
});
}
if (this.hasAttributeWithValue(answer, 'feedback')) {
feedback.push({
'#text': _.get(answer, 'feedback'),
});
}
if (feedback.length) {
singleAnswer[`${option}hint`] = feedback;
}
singleAnswer = {
'#text': answer.title,
'@_correct': answer.correct,
...singleAnswer,
};
choice.push(singleAnswer);
}
});
widget = { [option]: choice };
if (_.has(this.problemState, 'groupFeedbackList')) {
compoundhint = this.addGroupFeedbackList();
widget = {
...widget,
compoundhint,
};
}
return widget;
}
addGroupFeedbackList() {
const compoundhint = [];
const { groupFeedbackList } = this.problemState;
groupFeedbackList.forEach((element) => {
compoundhint.push({
'#text': element.feedback,
'@_value': element.answers.join(' '),
});
});
return compoundhint;
}
addQuestion() {
const { question } = this.problemState;
const questionObject = this.parser.parse(question);
return questionObject;
}
buildMultiSelectProblem(problemType, widget, option) {
const question = this.addQuestion();
const widgetObject = this.addMultiSelectAnswers(option);
const demandhint = this.addHints();
const problemObject = {
problem: {
[problemType]: {
...question,
[widget]: widgetObject,
},
...demandhint,
},
};
return this.builder.build(problemObject);
}
buildTextInput() {
const question = this.addQuestion();
const demandhint = this.addHints();
const answerObject = this.buildTextInputAnswersFeedback();
const problemObject = {
problem: {
[ProblemTypeKeys.TEXTINPUT]: {
...question,
...answerObject,
},
...demandhint,
},
};
return this.builder.build(problemObject);
}
buildTextInputAnswersFeedback() {
const { answers } = this.problemState;
let answerObject = {};
const additionAnswers = [];
const wrongAnswers = [];
let firstCorrectAnswerParsed = false;
answers.forEach((answer) => {
const correcthint = this.getAnswerHints(answer);
if (this.hasAttributeWithValue(answer, 'title')) {
if (answer.correct && firstCorrectAnswerParsed) {
additionAnswers.push({
'@_answer': answer.title,
...correcthint,
});
} else if (answer.correct && !firstCorrectAnswerParsed) {
firstCorrectAnswerParsed = true;
answerObject = {
'@_answer': answer.title,
...correcthint,
};
} else if (!answer.correct) {
wrongAnswers.push({
'@_answer': answer.title,
'#text': answer.feedback,
});
}
}
});
answerObject = {
...answerObject,
additional_answer: additionAnswers,
stringequalhint: wrongAnswers,
'@_type': _.get(this.problemState, 'additionalAttributes.type', 'ci'),
textline: {
'@_size': _.get(this.problemState, 'additionalAttributes.textline.size', 20),
},
};
return answerObject;
}
buildNumericInput() {
const question = this.addQuestion();
const demandhint = this.addHints();
const answerObject = this.buildNumericalResponse();
const problemObject = {
problem: {
...question,
[ProblemTypeKeys.NUMERIC]: answerObject,
...demandhint,
},
};
return this.builder.build(problemObject);
}
buildNumericalResponse() {
const { answers } = this.problemState;
let answerObject = {};
const additionalAnswers = [];
let firstCorrectAnswerParsed = false;
/*
TODO: Need to figure out how to add multiple numericalresponse,
the parser right now converts all the other right answers into
additional answers.
*/
answers.forEach((answer) => {
const correcthint = this.getAnswerHints(answer);
if (this.hasAttributeWithValue(answer, 'title')) {
if (answer.correct && !firstCorrectAnswerParsed) {
firstCorrectAnswerParsed = true;
let responseParam = {};
if (_.has(answer, 'tolerance')) {
responseParam = {
responseparam: {
'@_type': 'tolerance',
'@_default': _.get(answer, 'tolerance', 0),
},
};
}
answerObject = {
'@_answer': answer.title,
...responseParam,
...correcthint,
};
} else if (answer.correct && firstCorrectAnswerParsed) {
additionalAnswers.push({
'@_answer': answer.title,
...correcthint,
});
}
}
});
answerObject = {
...answerObject,
additional_answer: additionalAnswers,
formulaequationinput: {
'#text': '',
},
};
return answerObject;
}
getAnswerHints(elementObject) {
const feedback = elementObject?.feedback;
let correcthint = {};
if (feedback !== undefined && feedback !== '') {
correcthint = {
correcthint: {
'#text': feedback,
},
};
}
return correcthint;
}
hasAttributeWithValue(obj, attr) {
return _.has(obj, attr) && _.get(obj, attr, '').trim() !== '';
}
buildOLX() {
const { problemType } = this.problemState;
let problemString = '';
switch (problemType) {
case ProblemTypeKeys.MULTISELECT:
problemString = this.buildMultiSelectProblem(ProblemTypeKeys.MULTISELECT, 'checkboxgroup', 'choice');
break;
case ProblemTypeKeys.DROPDOWN:
problemString = this.buildMultiSelectProblem(ProblemTypeKeys.DROPDOWN, 'optioninput', 'option');
break;
case ProblemTypeKeys.SINGLESELECT:
problemString = this.buildMultiSelectProblem(ProblemTypeKeys.SINGLESELECT, 'choicegroup', 'choice');
break;
case ProblemTypeKeys.TEXTINPUT:
problemString = this.buildTextInput();
break;
case ProblemTypeKeys.NUMERIC:
problemString = this.buildNumericInput();
break;
default:
break;
}
return problemString;
}
}
export default ReactStateOLXParser;

View File

@@ -0,0 +1,63 @@
import { OLXParser } from './OLXParser';
import {
checkboxesOLXWithFeedbackAndHintsOLX,
dropdownOLXWithFeedbackAndHintsOLX,
numericInputWithFeedbackAndHintsOLX,
numericInputWithFeedbackAndHintsOLXException,
textInputWithFeedbackAndHintsOLX,
mutlipleChoiceWithFeedbackAndHintsOLX,
textInputWithFeedbackAndHintsOLXWithMultipleAnswers,
} from './mockData/olxTestData';
import ReactStateOLXParser from './ReactStateOLXParser';
describe('Check React Sate OLXParser problem', () => {
test('Test checkbox with feedback and hints problem type', () => {
const olxparser = new OLXParser(checkboxesOLXWithFeedbackAndHintsOLX.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(checkboxesOLXWithFeedbackAndHintsOLX.buildOLX);
});
test('Test dropdown with feedback and hints problem type', () => {
const olxparser = new OLXParser(dropdownOLXWithFeedbackAndHintsOLX.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(dropdownOLXWithFeedbackAndHintsOLX.buildOLX);
});
test('Test string response with feedback and hints problem type', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLX.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(textInputWithFeedbackAndHintsOLX.buildOLX);
});
test('Test multiple choice with feedback and hints problem type', () => {
const olxparser = new OLXParser(mutlipleChoiceWithFeedbackAndHintsOLX.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(mutlipleChoiceWithFeedbackAndHintsOLX.buildOLX);
});
test('Test numerical response with feedback and hints problem type', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLX.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(numericInputWithFeedbackAndHintsOLX.buildOLX);
});
test('Test numerical response with feedback and hints problem type with exception', () => {
const olxparser = new OLXParser(numericInputWithFeedbackAndHintsOLXException.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(numericInputWithFeedbackAndHintsOLXException.buildOLX);
});
test('Test string response with feedback and hints, multiple answers', () => {
const olxparser = new OLXParser(textInputWithFeedbackAndHintsOLXWithMultipleAnswers.rawOLX);
const problem = olxparser.getParsedOLXData();
const stateParser = new ReactStateOLXParser({ problem });
const buildOLX = stateParser.buildOLX();
expect(buildOLX).toEqual(textInputWithFeedbackAndHintsOLXWithMultipleAnswers.buildOLX);
});
});

View File

@@ -0,0 +1,24 @@
import { popuplateItem } from './SettingsParser';
class ReactStateSettingsParser {
constructor(problemState) {
this.problemState = problemState;
}
getSettings() {
let settings = {};
const stateSettings = this.problemState.settings;
settings = popuplateItem(settings, 'matLabApiKey', 'matlab_api_key', stateSettings);
settings = popuplateItem(settings, 'number', 'max_attempts', stateSettings.scoring.attempts);
settings = popuplateItem(settings, 'weight', 'weight', stateSettings.scoring);
settings = popuplateItem(settings, 'on', 'showanswer', stateSettings.showAnswer);
settings = popuplateItem(settings, 'afterAttempts', 'attempts_before_showanswer_button', stateSettings.showAnswer);
settings = popuplateItem(settings, 'showResetButton', 'show_reset_button', stateSettings);
settings = popuplateItem(settings, 'timeBetween', 'submission_wait_seconds', stateSettings);
return settings;
}
}
export default ReactStateSettingsParser;

View File

@@ -0,0 +1,12 @@
import ReactStateSettingsParser from './ReactStateSettingsParser';
import {
checklistWithFeebackHints,
} from './mockData/problemTestData';
describe('Test State to Settings Parser', () => {
test('Test settings parsed from react state', () => {
const settings = new ReactStateSettingsParser(checklistWithFeebackHints.state).getSettings();
const { markdown, ...settingsPayload } = checklistWithFeebackHints.metadata;
expect(settings).toStrictEqual(settingsPayload);
});
});

View File

@@ -0,0 +1,67 @@
import _ from 'lodash-es';
import { ShowAnswerTypes } from '../../../data/constants/problem';
export const popuplateItem = (parentObject, itemName, statekey, metadata) => {
let parent = parentObject;
const item = _.get(metadata, itemName, null);
if (!_.isNil(item)) {
parent = { ...parentObject, [statekey]: item };
}
return parent;
};
export const parseScoringSettings = (metadata) => {
let scoring = {};
let attempts = popuplateItem({}, 'max_attempts', 'number', metadata);
if (!_.isEmpty(attempts)) {
let unlimited = true;
if (attempts.number > 0) {
unlimited = false;
}
attempts = { ...attempts, unlimited };
scoring = { ...scoring, attempts };
}
scoring = popuplateItem(scoring, 'weight', 'weight', metadata);
return scoring;
};
export const parseShowAnswer = (metadata) => {
let showAnswer = {};
const showAnswerType = _.get(metadata, 'showanswer', {});
if (!_.isNil(showAnswerType) && showAnswerType in ShowAnswerTypes) {
showAnswer = { ...showAnswer, on: showAnswerType };
}
showAnswer = popuplateItem(showAnswer, 'attempts_before_showanswer_button', 'afterAttempts', metadata);
return showAnswer;
};
export const parseSettings = (metadata) => {
let settings = {};
if (_.isNil(metadata) || _.isEmpty(metadata)) {
return settings;
}
settings = popuplateItem(settings, 'matlab_api_key', 'matLabApiKey', metadata);
const scoring = parseScoringSettings(metadata);
if (!_.isEmpty(scoring)) {
settings = { ...settings, scoring };
}
const showAnswer = parseShowAnswer(metadata);
if (!_.isEmpty(showAnswer)) {
settings = { ...settings, showAnswer };
}
settings = popuplateItem(settings, 'show_reset_button', 'showResetButton', metadata);
settings = popuplateItem(settings, 'submission_wait_seconds', 'timeBetween', metadata);
return settings;
};

View File

@@ -0,0 +1,69 @@
import { parseScoringSettings, parseSettings, parseShowAnswer } from './SettingsParser';
import {
checklistWithFeebackHints,
dropdownWithFeedbackHints,
numericWithHints,
textInputWithHints,
sigleSelectWithHints,
} from './mockData/problemTestData';
describe('Test Settings to State Parser', () => {
test('Test all fields populated', () => {
const settings = parseSettings(checklistWithFeebackHints.metadata);
const { hints, ...settingsPayload } = checklistWithFeebackHints.state.settings;
expect(settings).toStrictEqual(settingsPayload);
});
test('Test partial fields populated', () => {
const settings = parseSettings(dropdownWithFeedbackHints.metadata);
const { hints, ...settingsPayload } = dropdownWithFeedbackHints.state.settings;
expect(settings).not.toStrictEqual(settingsPayload);
const { randomization, matLabApiKey, ...settingsPayloadPartial } = settingsPayload;
expect(settings).toStrictEqual(settingsPayloadPartial);
});
test('Test score settings', () => {
const scoreSettings = parseScoringSettings(checklistWithFeebackHints.metadata);
expect(scoreSettings).toStrictEqual(checklistWithFeebackHints.state.settings.scoring);
});
test('Test score settings zero attempts', () => {
const scoreSettings = parseScoringSettings(numericWithHints.metadata);
expect(scoreSettings).toStrictEqual(numericWithHints.state.settings.scoring);
});
test('Test score settings attempts missing', () => {
const scoreSettings = parseScoringSettings(textInputWithHints.metadata);
expect(scoreSettings.attempts).toBeUndefined();
});
test('Test score settings missing', () => {
const settings = parseSettings(sigleSelectWithHints.metadata);
expect(settings.scoring).toBeUndefined();
});
test('Test invalid randomization', () => {
const settings = parseSettings(numericWithHints.metadata);
expect(settings.randomization).toBeUndefined();
});
test('Test invalid show answer', () => {
const showAnswerSettings = parseShowAnswer(numericWithHints.metadata);
expect(showAnswerSettings.on).toBeUndefined();
});
test('Test show answer settings missing', () => {
const settings = parseShowAnswer(textInputWithHints.metadata);
expect(settings.showAnswer).toBeUndefined();
});
test('Test empty metadata', () => {
const scoreSettings = parseSettings({});
expect(scoreSettings).toStrictEqual({});
});
test('Test null metadata', () => {
const scoreSettings = parseSettings(null);
expect(scoreSettings).toStrictEqual({});
});
});

View File

@@ -0,0 +1,555 @@
export const checkboxesOLXWithFeedbackAndHintsOLX = {
rawOLX: `<problem>
<choiceresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this.</description>
<checkboxgroup>
<choice correct="true">a correct answer
<choicehint selected="true">You can specify optional feedback that appears after the learner selects and submits this answer.</choicehint>
<choicehint selected="false">You can specify optional feedback that appears after the learner clears and submits this answer.</choicehint>
</choice>
<choice correct="false">an incorrect answer</choice>
<choice correct="false">an incorrect answer
<choicehint selected="true">You can specify optional feedback for none, all, or a subset of the answers.</choicehint>
<choicehint selected="false">You can specify optional feedback for selected answers, cleared answers, or both.</choicehint>
</choice>
<choice correct="true">a correct answer</choice>
<compoundhint value="A B D">You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.</compoundhint>
<compoundhint value="A B C D">You can specify optional feedback for one, several, or all answer combinations.</compoundhint>
</checkboxgroup>
</choiceresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: 'a correct answer',
correct: true,
selectedFeedback: 'You can specify optional feedback that appears after the learner selects and submits this answer.',
unselectedFeedback: 'You can specify optional feedback that appears after the learner clears and submits this answer.',
},
{
id: 'B',
title: 'an incorrect answer',
correct: false,
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
selectedFeedback: 'You can specify optional feedback for none, all, or a subset of the answers.',
unselectedFeedback: 'You can specify optional feedback for selected answers, cleared answers, or both.',
},
{
id: 'D',
title: 'a correct answer',
correct: true,
},
],
groupFeedbackList: [
{
id: 0,
answers: [
'A',
'B',
'D',
],
feedback: 'You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.',
},
{
id: 1,
answers: [
'A',
'B',
'C',
'D',
],
feedback: 'You can specify optional feedback for one, several, or all answer combinations.',
},
],
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<choiceresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<checkboxgroup>
<choice correct="true">
a correct answer <choicehint selected="true">You can specify optional feedback that appears after the learner selects and submits this answer.</choicehint>
<choicehint selected="false">You can specify optional feedback that appears after the learner clears and submits this answer.</choicehint>
</choice>
<choice correct="false">an incorrect answer</choice>
<choice correct="false">
an incorrect answer <choicehint selected="true">You can specify optional feedback for none, all, or a subset of the answers.</choicehint>
<choicehint selected="false">You can specify optional feedback for selected answers, cleared answers, or both.</choicehint>
</choice>
<choice correct="true">a correct answer</choice>
<compoundhint value="A B D">You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.</compoundhint>
<compoundhint value="A B C D">You can specify optional feedback for one, several, or all answer combinations.</compoundhint>
</checkboxgroup>
</choiceresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const dropdownOLXWithFeedbackAndHintsOLX = {
rawOLX: `<problem>
<optionresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<optioninput>
<option correct="false">an incorrect answer <optionhint>You can specify optional feedback like this, which appears after this answer is submitted.</optionhint>
</option>
<option correct="true">the correct answer</option>
<option correct="false">an incorrect answer <optionhint>You can specify optional feedback for none, a subset, or all of the answers.</optionhint>
</option>
</optioninput>
</optionresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
id: 'B',
title: 'the correct answer',
correct: true,
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
},
],
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<optionresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<optioninput>
<option correct="false">
an incorrect answer <optionhint>You can specify optional feedback like this, which appears after this answer is submitted.</optionhint>
</option>
<option correct="true">the correct answer</option>
<option correct="false">
an incorrect answer <optionhint>You can specify optional feedback for none, a subset, or all of the answers.</optionhint>
</option>
</optioninput>
</optionresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const mutlipleChoiceWithFeedbackAndHintsOLX = {
rawOLX: `<problem>
<multiplechoiceresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<choicegroup type="MultipleChoice">
<choice correct="false">an incorrect answer <choicehint>You can specify optional feedback like this, which appears after this answer is submitted.</choicehint>
</choice>
<choice correct="true">the correct answer</choice>
<choice correct="false">an incorrect answer <choicehint>You can specify optional feedback for none, a subset, or all of the answers.</choicehint>
</choice>
</choicegroup>
</multiplechoiceresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
id: 'B',
title: 'the correct answer',
correct: true,
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
},
],
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<multiplechoiceresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<choicegroup>
<choice correct="false">
an incorrect answer <choicehint>You can specify optional feedback like this, which appears after this answer is submitted.</choicehint>
</choice>
<choice correct="true">the correct answer</choice>
<choice correct="false">
an incorrect answer <choicehint>You can specify optional feedback for none, a subset, or all of the answers.</choicehint>
</choice>
</choicegroup>
</multiplechoiceresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const numericInputWithFeedbackAndHintsOLX = {
rawOLX: `<problem>
<numericalresponse answer="100">
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<responseparam type="tolerance" default="5"/>
<formulaequationinput/>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="200"><correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint></additional_answer>
</numericalresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: '100',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
tolerance: '5',
},
{
id: 'B',
title: '200',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
],
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<numericalresponse answer="100">
<responseparam type="tolerance" default="5"></responseparam>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="200">
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
</additional_answer>
<formulaequationinput></formulaequationinput>
</numericalresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const textInputWithFeedbackAndHintsOLX = {
rawOLX: `<problem>
<stringresponse answer="the correct answer" type="ci">
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="optional acceptable variant of the correct answer"/>
<stringequalhint answer="optional incorrect answer such as a frequent misconception">You can specify optional feedback for none, a subset, or all of the answers.</stringequalhint>
<textline size="20"/>
</stringresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: 'the correct answer',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
id: 'B',
title: 'optional acceptable variant of the correct answer',
correct: true,
feedback: '',
},
{
id: 'C',
title: 'optional incorrect answer such as a frequent misconception',
correct: false,
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
},
],
additionalStringAttributes: {
type: 'ci',
textline: {
size: '20',
},
},
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<stringresponse answer="the correct answer" type="ci">
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="optional acceptable variant of the correct answer"></additional_answer>
<stringequalhint answer="optional incorrect answer such as a frequent misconception">You can specify optional feedback for none, a subset, or all of the answers.</stringequalhint>
<textline size="20"></textline>
</stringresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const textInputWithFeedbackAndHintsOLXWithMultipleAnswers = {
rawOLX: `<problem>
<stringresponse answer="the correct answer" type="ci">
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="300"><correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint> </additional_answer>
<additional_answer answer="400"><correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint> </additional_answer>
<stringequalhint answer="optional incorrect answer such as a frequent misconception">You can specify optional feedback for none, a subset, or all of the answers.</stringequalhint>
<textline size="20"/>
</stringresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
hints: [{
id: 0,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 1,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
data: {
answers: [
{
id: 'A',
title: 'the correct answer',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
id: 'B',
title: '300',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
id: 'C',
title: '400',
},
{
id: 'D',
title: 'optional incorrect answer such as a frequent misconception',
correct: false,
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
},
],
additionalStringAttributes: {
type: 'ci',
textline: {
size: '20',
},
},
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<stringresponse answer="the correct answer" type="ci">
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<additional_answer answer="300">
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
</additional_answer>
<additional_answer answer="400">
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
</additional_answer>
<stringequalhint answer="optional incorrect answer such as a frequent misconception">You can specify optional feedback for none, a subset, or all of the answers.</stringequalhint>
<textline size="20"></textline>
</stringresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};
export const numericInputWithFeedbackAndHintsOLXException = {
rawOLX: `<problem>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>You can add an optional tip or note related to the prompt like this. </description>
<numericalresponse answer="300">
<formulaequationinput />
</numericalresponse>
<numericalresponse answer="100">
<responseparam type="tolerance" default="5" />
<formulaequationinput />
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
</numericalresponse>
<numericalresponse answer="200">
<responseparam type="tolerance" default="4" />
<additional_answer answer="500"><correcthint>This is one feedback!</correcthint></additional_answer>
<formulaequationinput />
</numericalresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>`,
data: {
answers: [
{
id: 'A',
title: '300',
correct: true,
feedback: '',
},
{
id: 'B',
title: '100',
correct: true,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
tolerance: '5',
},
{
id: 'C',
title: '200',
correct: true,
feedback: '',
tolerance: '4',
},
{
id: 'D',
title: '500',
correct: true,
feedback: 'This is one feedback!',
},
],
},
question: '<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p><bold>Add the question text, or prompt, here. This text is required.</bold><em>You can add an optional tip or note related to the prompt like this.</em>',
buildOLX: `<problem>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<bold>Add the question text, or prompt, here. This text is required.</bold>
<em>You can add an optional tip or note related to the prompt like this.</em>
<numericalresponse answer="300">
<additional_answer answer="100">
<correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
</additional_answer>
<additional_answer answer="200"></additional_answer>
<additional_answer answer="500">
<correcthint>This is one feedback!</correcthint>
</additional_answer>
<formulaequationinput></formulaequationinput>
</numericalresponse>
<demandhint>
<hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint>
</problem>
`,
};

View File

@@ -0,0 +1,389 @@
export const checklistWithFeebackHints = {
state: {
rawOLX: '<problem>\n <choiceresponse>\n <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>\n <label>Add the question text, or prompt, here. This text is required.</label>\n <description>You can add an optional tip or note related to the prompt like this.</description>\n <checkboxgroup>\n <choice correct="true">a correct answer\n <choicehint selected="true">You can specify optional feedback that appears after the learner selects and submits this answer.</choicehint>\n <choicehint selected="false">You can specify optional feedback that appears after the learner clears and submits this answer.</choicehint>\n </choice>\n <choice correct="false">an incorrect answer\n </choice>\n <choice correct="false">an incorrect answer\n <choicehint selected="true">You can specify optional feedback for none, all, or a subset of the answers.</choicehint>\n <choicehint selected="false">You can specify optional feedback for selected answers, cleared answers, or both.</choicehint>\n </choice>\n <choice correct="true">a correct answer\n </choice>\n <compoundhint value="A B D">You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.</compoundhint>\n <compoundhint value="A B C D">You can specify optional feedback for one, several, or all answer combinations.</compoundhint>\n </checkboxgroup>\n </choiceresponse>\n\n <demandhint>\n <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>\n <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>\n </demandhint>\n</problem>\n',
problemType: 'MULTISELECT',
question: 'You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.\n\n<p>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this.</p>\n\n',
answers: [
{
id: 'A',
title: 'a correct answer',
correct: true,
selectedFeedback: ' You can specify optional feedback that appears after the learner selects and submits this answer.',
unselectedFeedback: 'You can specify optional feedback that appears after the learner clears and submits this answer.',
},
{
id: 'B',
title: 'an incorrect answer',
correct: false,
selectedFeedback: '',
unselectedFeedback: '',
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
selectedFeedback: ' You can specify optional feedback for none, all, or a subset of the answers.',
unselectedFeedback: 'You can specify optional feedback for selected answers, cleared answers, or both.',
},
{
id: 'D',
title: 'a correct answer',
correct: true,
selectedFeedback: '',
unselectedFeedback: '',
},
],
groupFeedbackList: [
{
id: 3,
answers: [
'A',
'B',
'D',
],
feedback: 'You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.',
},
{
id: 4,
answers: [
'A',
'B',
'C',
'D',
],
feedback: 'You can specify optional feedback for one, several, or all answer combinations.',
},
],
settings: {
hints: [
{
id: 14,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 15,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
scoring: {
weight: 2.5,
attempts: {
unlimited: false,
number: 5,
},
},
timeBetween: 3,
matLabApiKey: 'sample_matlab_api_key',
showAnswer: {
on: 'after_attempts',
afterAttempts: 2,
},
showResetButton: true,
},
},
metadata: {
markdown: `You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.
>>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this.<<
[x] a correct answer{{selected: You can specify optional feedback that appears after the learner selects and submits this answer.},{unselected: You can specify optional feedback that appears after the learner clears and submits this answer.}}
[ ] an incorrect answer
[ ] an incorrect answer{{selected: You can specify optional feedback for none, all, or a subset of the answers.},{unselected: You can specify optional feedback for selected answers, cleared answers, or both.}}
[x] a correct answer
||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
{{ (( A B D )) You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted. }}
{{ (( A B C D )) You can specify optional feedback for one, several, or all answer combinations. }}
`,
matlab_api_key: 'sample_matlab_api_key',
max_attempts: 5,
show_reset_button: true,
showanswer: 'after_attempts',
attempts_before_showanswer_button: 2,
submission_wait_seconds: 3,
weight: 2.5,
},
};
export const dropdownWithFeedbackHints = {
state: {
rawOLX: '<problem>\n <optionresponse>\n <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>\n <label>Add the question text, or prompt, here. This text is required.</label>\n <description>You can add an optional tip or note related to the prompt like this. </description>\n <optioninput>\n <option correct="False">an incorrect answer <optionhint>You can specify optional feedback like this, which appears after this answer is submitted.</optionhint></option>\n <option correct="True">the correct answer</option>\n <option correct="False">an incorrect answer <optionhint>You can specify optional feedback for none, a subset, or all of the answers.</optionhint></option>\n </optioninput>\n </optionresponse>\n <demandhint>\n <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>\n <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>\n </demandhint>\n</problem>\n',
problemType: 'DROPDOWN',
question: 'You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.\n<p>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. </p>\n',
answers: [
{
id: 'A',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
},
{
id: 'B',
title: 'the correct answer',
correct: true,
feedback: '',
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
},
],
groupFeedbackList: [],
settings: {
hints: [
{
id: 8,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 9,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
scoring: {
weight: 2.5,
attempts: {
unlimited: false,
number: 5,
},
},
timeBetween: 3,
matLabApiKey: '',
showAnswer: {
on: 'after_attempts',
afterAttempts: 2,
},
showResetButton: true,
},
},
metadata: {
markdown: `You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.
>>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
[[
an incorrect answer {{You can specify optional feedback like this, which appears after this answer is submitted.}}
(the correct answer)
an incorrect answer {{You can specify optional feedback for none, a subset, or all of the answers.}}
]]
||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
`,
max_attempts: 5,
show_reset_button: true,
showanswer: 'after_attempts',
attempts_before_showanswer_button: 2,
submission_wait_seconds: 3,
weight: 2.5,
},
};
export const numericWithHints = {
state: {
rawOLX: '<problem>\n <numericalresponse answer="100">\n <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>\n <label>Add the question text, or prompt, here. This text is required.</label>\n <description>You can add an optional tip or note related to the prompt like this.</description>\n <responseparam type="tolerance" default="5"/>\n <formulaequationinput/>\n <correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>\n </numericalresponse>\n <demandhint>\n <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>\n <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>\n </demandhint>\n</problem>\n',
problemType: 'TEXTINPUT',
question: 'You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.\n\n<p>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. </p>\n\n',
answers: [
{
id: 'A',
title: '100 +-5',
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
correct: true,
},
{
id: 'B',
title: '90 +-5',
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
correct: true,
},
{
id: 'C',
title: '60 +-5',
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
correct: false,
},
],
groupFeedbackList: [],
settings: {
hints: [
{
id: 6,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 7,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
scoring: {
weight: 2.5,
attempts: {
unlimited: true,
number: 0,
},
},
timeBetween: 0,
matLabApiKey: '',
showAnswer: {
on: 'after_attempts',
afterAttempts: 1,
},
showResetButton: false,
},
},
metadata: {
markdown: `You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.
>>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
=100 +-5 {{You can specify optional feedback like this, which appears after this answer is submitted.}}
or=90 +-5 {{You can specify optional feedback like this, which appears after this answer is submitted.}}
not=60 +-5 {{You can specify optional feedback like this, which appears after this answer is submitted.}}
||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
`,
weight: 2.5,
max_attempts: 0,
rerandomize: 'invalid_input',
showanswer: 'invalid_input',
attempts_before_showanswer_button: 2,
},
};
export const textInputWithHints = {
state: {
rawOLX: '<problem>\n <stringresponse answer="the correct answer" type="ci">\n <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>\n <label>Add the question text, or prompt, here. This text is required.</label>\n <description>You can add an optional tip or note related to the prompt like this.</description>\n <correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>\n <additional_answer answer="optional acceptable variant of the correct answer"/>\n <stringequalhint answer="optional incorrect answer such as a frequent misconception">You can specify optional feedback for none, a subset, or all of the answers.</stringequalhint>\n <textline size="20"/>\n </stringresponse>\n <demandhint>\n <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>\n <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>\n </demandhint>\n</problem>\n',
problemType: 'TEXTINPUT',
question: 'You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.\n\n<p>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. </p>\n\n',
answers: [
{
id: 'A',
title: 'the correct answer',
feedback: 'You can specify optional feedback like this, which appears after this answer is submitted.',
correct: true,
},
{
id: 'B',
title: 'optional acceptable variant of the correct answer',
feedback: '',
correct: true,
},
{
id: 'C',
title: 'optional incorrect answer such as a frequent misconception',
feedback: 'You can specify optional feedback for none, a subset, or all of the answers.',
correct: false,
},
],
groupFeedbackList: [],
settings: {
hints: [
{
id: 9,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 10,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
scoring: {
weight: 2.5,
attempts: {
unlimited: true,
number: 0,
},
},
timeBetween: 0,
matLabApiKey: '',
showAnswer: {
on: '',
afterAttempts: 1,
},
showResetButton: false,
},
},
metadata: {
markdown: `You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.
>>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
=the correct answer {{You can specify optional feedback like this, which appears after this answer is submitted.}}
or=optional acceptable variant of the correct answer
not=optional incorrect answer such as a frequent misconception {{You can specify optional feedback for none, a subset, or all of the answers.}}
||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
`,
weight: 2.5,
},
};
export const sigleSelectWithHints = {
state: {
rawOLX: '<problem>\n<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>\n\n<label>Add the question text, or prompt, here. This text is required.</label>\n<description>You can add an optional tip or note related to the prompt like this.</description>\n<multiplechoiceresponse>\n <choicegroup type="MultipleChoice">\n <choice correct="true">a correct answer <choicehint>selected: You can specify optional feedback that appears after the learner selects and submits this answer. }, { unselected: You can specify optional feedback that appears after the learner clears and submits this answer.</choicehint></choice>\n <choice correct="false">an incorrect answer</choice>\n <choice correct="false">an incorrect answer <choicehint>selected: You can specify optional feedback for none, all, or a subset of the answers. }, { unselected: You can specify optional feedback for selected answers, cleared answers, or both.</choicehint></choice>\n <choice correct="false">an incorrect answer again</choice>\n </choicegroup>\n</multiplechoiceresponse>\n<choiceresponse>\n <checkboxgroup>\n <compoundhint value="A B D">You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.</compoundhint>\n <compoundhint value="A B C D">You can specify optional feedback for one, several, or all answer combinations.</compoundhint>\n </checkboxgroup>\n</choiceresponse>\n\n\n<demandhint>\n <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>\n <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>\n</demandhint>\n</problem>',
problemType: 'SINGLESELECT',
question: 'You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.\n\n<p>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this.</p>\n\n',
answers: [
{
id: 'A',
title: 'a correct answer',
correct: true,
feedback: 'Some new feedback',
},
{
id: 'B',
title: 'an incorrect answer',
correct: false,
feedback: '',
},
{
id: 'C',
title: 'an incorrect answer',
correct: false,
feedback: 'Wrong feedback',
},
{
id: 'D',
title: 'an incorrect answer again',
correct: false,
feedback: '',
},
],
groupFeedbackList: [],
settings: {
hints: [
{
id: 13,
value: 'You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.',
},
{
id: 14,
value: 'If you add more than one hint, a different hint appears each time learners select the hint button.',
},
],
scoring: {
weight: 0,
attempts: {
unlimited: true,
number: 0,
},
},
timeBetween: 0,
matLabApiKey: '',
showAnswer: {
on: '',
afterAttempts: 1,
},
showResetButton: false,
},
},
metadata: {
markdown: `You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.
>>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this.<<
(x) a correct answer {{Some new feedback}}
( ) an incorrect answer
( ) an incorrect answer {{Wrong feedback}}
( ) an incorrect answer again
||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
`,
},
};