@pie-element/multiple-choice 12.1.2-next.6 → 12.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/controller/CHANGELOG.md +10 -0
- package/controller/lib/index.js +42 -5
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [12.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.1.2-next.6...@pie-element/multiple-choice@12.2.0-next.0) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- test ([be07920](https://github.com/pie-framework/pie-elements/commit/be07920477def42dc240d032783be437400b7e93))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **multiple-choice:** add trace log for scoring in outcome function PD-5434 ([0f49930](https://github.com/pie-framework/pie-elements/commit/0f49930da8d4098ad0bec74fc462942ddf031172))
|
|
15
|
+
|
|
6
16
|
## [12.1.2-next.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.1.2-next.5...@pie-element/multiple-choice@12.1.2-next.6) (2026-03-12)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [7.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@7.1.1-next.1...@pie-element/multiple-choice-controller@7.2.0-next.0) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- test ([be07920](https://github.com/pie-framework/pie-elements/commit/be07920477def42dc240d032783be437400b7e93))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **multiple-choice:** add trace log for scoring in outcome function PD-5434 ([0f49930](https://github.com/pie-framework/pie-elements/commit/0f49930da8d4098ad0bec74fc462942ddf031172))
|
|
15
|
+
|
|
6
16
|
## [7.1.1-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@7.1.0-next.1...@pie-element/multiple-choice-controller@7.1.1-next.1) (2026-02-26)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createCorrectResponseSession = void 0;
|
|
8
8
|
exports.createDefaultModel = createDefaultModel;
|
|
9
|
-
exports.getScore = void 0;
|
|
9
|
+
exports.getScore = exports.getLogTrace = void 0;
|
|
10
10
|
exports.model = model;
|
|
11
11
|
exports.normalize = void 0;
|
|
12
12
|
exports.outcome = outcome;
|
|
@@ -139,6 +139,40 @@ const getScore = (config, session) => {
|
|
|
139
139
|
return parseFloat(str.toFixed(2));
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Generates detailed trace log for scoring evaluation
|
|
144
|
+
* @param {Object} model - the question model
|
|
145
|
+
* @param {Object} session - the student session
|
|
146
|
+
* @param {Object} env - the environment
|
|
147
|
+
* @returns {Array} traceLog - array of trace messages
|
|
148
|
+
*/
|
|
149
|
+
exports.getScore = getScore;
|
|
150
|
+
const getLogTrace = (model, session, env) => {
|
|
151
|
+
const traceLog = [];
|
|
152
|
+
const selected = session?.value || [];
|
|
153
|
+
const questionType = model.choiceMode === 'radio' ? 'multiple-choice (radio)' : 'multiple-select (checkbox)';
|
|
154
|
+
traceLog.push(`Question type: ${questionType}.`);
|
|
155
|
+
if (selected.length) {
|
|
156
|
+
traceLog.push(`Student selected ${selected.length} answer(s): ${selected.join(', ')}.`);
|
|
157
|
+
} else {
|
|
158
|
+
traceLog.push('Student did not select any answers.');
|
|
159
|
+
}
|
|
160
|
+
const correctChoices = (model.choices || []).filter(c => c.correct);
|
|
161
|
+
const correctValues = correctChoices.map(c => c.value);
|
|
162
|
+
traceLog.push(`${correctChoices.length} correct answer(s) are defined for this question.`);
|
|
163
|
+
if (selected.length) {
|
|
164
|
+
const correctSelected = selected.filter(v => correctValues.includes(v));
|
|
165
|
+
const incorrectSelected = selected.filter(v => !correctValues.includes(v));
|
|
166
|
+
traceLog.push(`Student selected ${correctSelected.length} correct and ${incorrectSelected.length} incorrect answer(s).`);
|
|
167
|
+
}
|
|
168
|
+
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env) && model.choiceMode !== 'radio';
|
|
169
|
+
const scoringMethod = partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring';
|
|
170
|
+
traceLog.push(`Score calculated using ${scoringMethod}.`);
|
|
171
|
+
const score = getScore(model, session);
|
|
172
|
+
traceLog.push(`Final score: ${score}.`);
|
|
173
|
+
return traceLog;
|
|
174
|
+
};
|
|
175
|
+
|
|
142
176
|
/**
|
|
143
177
|
*
|
|
144
178
|
* The score is partial by default for checkbox mode, allOrNothing for radio mode.
|
|
@@ -148,20 +182,23 @@ const getScore = (config, session) => {
|
|
|
148
182
|
* @param {*} session
|
|
149
183
|
* @param {Object} env
|
|
150
184
|
*/
|
|
151
|
-
exports.
|
|
185
|
+
exports.getLogTrace = getLogTrace;
|
|
152
186
|
function outcome(model, session, env) {
|
|
153
187
|
return new Promise(resolve => {
|
|
154
188
|
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
155
189
|
resolve({
|
|
156
190
|
score: 0,
|
|
157
|
-
empty: true
|
|
191
|
+
empty: true,
|
|
192
|
+
traceLog: ['Student did not select any answers. Score is 0.']
|
|
158
193
|
});
|
|
159
194
|
} else {
|
|
160
|
-
const
|
|
195
|
+
const traceLog = getLogTrace(model, session, env);
|
|
161
196
|
const score = getScore(model, session);
|
|
197
|
+
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env) && model.choiceMode !== 'radio';
|
|
162
198
|
resolve({
|
|
163
199
|
score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
|
|
164
|
-
empty: false
|
|
200
|
+
empty: false,
|
|
201
|
+
traceLog
|
|
165
202
|
});
|
|
166
203
|
}
|
|
167
204
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_lodashEs","require","_utils","_defaults","_interopRequireDefault","_controllerUtils","prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","exports","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","lockChoices","getShuffledChoices","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","isResponseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","minSelections","maxSelections","keyboardEventsEnabled","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","teacherInstructions","teacherInstructionsEnabled","getScore","config","isEmpty","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { isEmpty } from 'lodash-es';\nimport { isResponseCorrect } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'value');\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n fontSizeFactor: normalizedQuestion.fontSizeFactor,\n isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,\n selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',\n selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',\n selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',\n hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',\n hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',\n hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',\n minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\n keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,\n autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: normalizedQuestion.completeAudioEnabled,\n customAudioButton: normalizedQuestion.customAudioButton,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter((ch) => ch.correct);\n\n let score = selectedChoices.reduce(\n (acc, selectedChoice) => acc + (correctChoices.find((ch) => ch.value === selectedChoice) ? 1 : 0),\n 0,\n );\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter((c) => c.correct).map((c) => c.value),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n const rationaleErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAJA;;AAMA,MAAMK,aAAa,GAAGA,CAACC,KAAK,EAAEC,GAAG,EAAEC,eAAe,KAAMC,MAAM,IAAK;EACjE,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGJ,GAAG,IAAI,CAAC,CAAC;EAChC,MAAMK,GAAG,GAAG;IACVC,KAAK,EAAEJ,MAAM,CAACI,KAAK;IACnBC,KAAK,EAAEL,MAAM,CAACK;EAChB,CAAC;EAED,IAAIJ,IAAI,KAAK,YAAY,KAAKC,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,UAAU,CAAC,EAAE;IACrEC,GAAG,CAACG,SAAS,GAAGT,KAAK,CAACU,gBAAgB,GAAGP,MAAM,CAACM,SAAS,GAAG,IAAI;EAClE,CAAC,MAAM;IACLH,GAAG,CAACG,SAAS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,SAAS,CAAC,EAAE;MACxD2F,eAAe,CAAC5F,KAAK,CAAC,GAAG,yBAAyB;IACpD;EACF,CAAC,CAAC;EAEF,MAAMsG,WAAW,GAAG,CAAC9E,OAAO,IAAI,EAAE,EAAE6C,MAAM;EAE1C,IAAIiC,WAAW,GAAGf,gBAAgB,EAAE;IAClCM,MAAM,CAACU,aAAa,GAAG,4BAA4BhB,gBAAgB,mBAAmB;EACxF,CAAC,MAAM,IAAIe,WAAW,GAAGd,gBAAgB,EAAE;IACzCK,MAAM,CAACU,aAAa,GAAG,gBAAgBf,gBAAgB,6BAA6B;EACtF;EAEA,IAAI,CAACS,kBAAkB,EAAE;IACvBJ,MAAM,CAACW,eAAe,GAAG,8BAA8B;EACzD;EAEA,IAAI,CAAC,IAAA7C,iBAAO,EAACgC,aAAa,CAAC,EAAE;IAC3BE,MAAM,CAACrE,OAAO,GAAGmE,aAAa;EAChC;EAEA,IAAI,CAAC,IAAAhC,iBAAO,EAACiC,eAAe,CAAC,EAAE;IAC7BC,MAAM,CAAC5F,SAAS,GAAG2F,eAAe;EACpC;EAEA,OAAOC,MAAM;AACf,CAAC;AAAC5E,OAAA,CAAAqE,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_lodashEs","require","_utils","_defaults","_interopRequireDefault","_controllerUtils","prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","exports","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","lockChoices","getShuffledChoices","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","isResponseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","minSelections","maxSelections","keyboardEventsEnabled","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","teacherInstructions","teacherInstructionsEnabled","getScore","config","isEmpty","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","getLogTrace","traceLog","selected","questionType","push","join","c","correctValues","correctSelected","v","includes","incorrectSelected","partialScoringEnabled","partialScoring","enabled","scoringMethod","outcome","empty","createCorrectResponseSession","id","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { isEmpty } from 'lodash-es';\nimport { isResponseCorrect } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'value');\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n fontSizeFactor: normalizedQuestion.fontSizeFactor,\n isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,\n selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',\n selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',\n selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',\n hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',\n hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',\n hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',\n minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\n keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,\n autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: normalizedQuestion.completeAudioEnabled,\n customAudioButton: normalizedQuestion.customAudioButton,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter((ch) => ch.correct);\n\n let score = selectedChoices.reduce(\n (acc, selectedChoice) => acc + (correctChoices.find((ch) => ch.value === selectedChoice) ? 1 : 0),\n 0,\n );\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const selected = session?.value || [];\n \n const questionType = model.choiceMode === 'radio' ? 'multiple-choice (radio)' : 'multiple-select (checkbox)';\n traceLog.push(`Question type: ${questionType}.`);\n \n if (selected.length) {\n traceLog.push(`Student selected ${selected.length} answer(s): ${selected.join(', ')}.`);\n } else {\n traceLog.push('Student did not select any answers.');\n }\n\n const correctChoices = (model.choices || []).filter((c) => c.correct);\n const correctValues = correctChoices.map((c) => c.value);\n traceLog.push(`${correctChoices.length} correct answer(s) are defined for this question.`);\n \n if (selected.length) {\n const correctSelected = selected.filter((v) => correctValues.includes(v));\n const incorrectSelected = selected.filter((v) => !correctValues.includes(v));\n traceLog.push(\n `Student selected ${correctSelected.length} correct and ${incorrectSelected.length} incorrect answer(s).`\n );\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const scoringMethod = partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring';\n traceLog.push(`Score calculated using ${scoringMethod}.`);\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, traceLog: ['Student did not select any answers. Score is 0.'] });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n\n resolve({ \n score: partialScoringEnabled ? score : score === 1 ? 1 : 0, \n empty: false, \n traceLog \n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter((c) => c.correct).map((c) => c.value),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n const rationaleErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAJA;;AAMA,MAAMK,aAAa,GAAGA,CAACC,KAAK,EAAEC,GAAG,EAAEC,eAAe,KAAMC,MAAM,IAAK;EACjE,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGJ,GAAG,IAAI,CAAC,CAAC;EAChC,MAAMK,GAAG,GAAG;IACVC,KAAK,EAAEJ,MAAM,CAACI,KAAK;IACnBC,KAAK,EAAEL,MAAM,CAACK;EAChB,CAAC;EAED,IAAIJ,IAAI,KAAK,YAAY,KAAKC,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,UAAU,CAAC,EAAE;IACrEC,GAAG,CAACG,SAAS,GAA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,CAAC,EAAE;IAC3BE,MAAM,CAACjF,OAAO,GAAG+E,aAAa;EAChC;EAEA,IAAI,CAAC,IAAA5C,iBAAO,EAAC6C,eAAe,CAAC,EAAE;IAC7BC,MAAM,CAACxG,SAAS,GAAGuG,eAAe;EACpC;EAEA,OAAOC,MAAM;AACf,CAAC;AAACxF,OAAA,CAAAiF,QAAA,GAAAA,QAAA","ignoreList":[]}
|
package/controller/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.2.0-next.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "18.3.1",
|
|
24
24
|
"react-transition-group": "^4.4.5"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "11169f258ac462817f622c5272b360009b6675ab",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postpublish": "../../scripts/postpublish"
|
|
29
29
|
},
|