@pie-element/categorize 13.1.1-next.11 → 13.1.1-next.31

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.
@@ -116,6 +116,7 @@ class CategorizeConfigure extends HTMLElement {
116
116
  disconnectedCallback() {
117
117
  if (this._root) {
118
118
  this._root.unmount();
119
+ this._root = null;
119
120
  }
120
121
  }
121
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_pieConfigureEvents","_mathRendering","_main","_defaults","CategorizeConfigure","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","defaults","configuration","model","m","choices","length","maxAnswerChoices","console","warn","render","c","newConfiguration","language","enabled","languageChoices","options","value","settings","find","option","push","label","onModelChanged","dispatchEvent","ModelUpdatedEvent","onConfigurationChanged","connectedCallback","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","el","React","createElement","Main","bind","imageSupport","add","delete","uploadSoundSupport","createRoot","setTimeout","renderMath","disconnectedCallback","unmount","exports","default","_defineProperty2","correctResponse","mappedCorrectResponse","map","cr","alternateResponses","response","allowAlternateEnabled"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport Main from './main';\n\nimport defaults from './defaults';\n\nexport default class CategorizeConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => ({\n ...defaults.model,\n ...model,\n });\n\n // PD-2960: make sure we don't have alternates in model or possibility to add them (temporary solution)\n // this function is used in controller, too\n static disableAlternateResponses = (m) => {\n let { correctResponse } = m || {};\n correctResponse = correctResponse || [];\n const mappedCorrectResponse = correctResponse.map((cr) => {\n const { alternateResponses, ...response } = cr;\n return response;\n });\n return {\n ...m,\n correctResponse: mappedCorrectResponse,\n allowAlternateEnabled: false,\n };\n };\n\n constructor() {\n super();\n this._root = null;\n this._model = CategorizeConfigure.createDefaultModel();\n this._configuration = defaults.configuration;\n }\n\n set model(m) {\n this._model = CategorizeConfigure.createDefaultModel(m);\n\n if (m.choices && m.choices.length >= m.maxAnswerChoices) {\n this._model.maxAnswerChoices = m.choices.length;\n console.warn(\"Max Answer Choices can't be less than choices length!\");\n }\n\n this.render();\n }\n\n set configuration(c) {\n const newConfiguration = {\n ...defaults.configuration,\n ...c,\n };\n\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this.render();\n }\n\n onModelChanged(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n this.render();\n }\n\n connectedCallback() {\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n const el = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n\n setTimeout(() => {\n renderMath(this);\n }, 0);\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAOA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEe,MAAMM,mBAAmB,SAASC,WAAW,CAAC;EAsB3DC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CAACC,MAAM,GAAGJ,mBAAmB,CAACK,kBAAkB,CAAC,CAAC;IACtD,IAAI,CAACC,cAAc,GAAGC,iBAAQ,CAACC,aAAa;EAC9C;EAEA,IAAIC,KAAKA,CAACC,CAAC,EAAE;IACX,IAAI,CAACN,MAAM,GAAGJ,mBAAmB,CAACK,kBAAkB,CAACK,CAAC,CAAC;IAEvD,IAAIA,CAAC,CAACC,OAAO,IAAID,CAAC,CAACC,OAAO,CAACC,MAAM,IAAIF,CAAC,CAACG,gBAAgB,EAAE;MACvD,IAAI,CAACT,MAAM,CAACS,gBAAgB,GAA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,eAAe,GAAGA,eAAe,IAAI,EAAE;EACvC,MAAMC,qBAAqB,GAAGD,eAAe,CAACE,GAAG,CAAEC,EAAE,IAAK;IACxD,MAAM;MAAEC,kBAAkB;MAAE,GAAGC;IAAS,CAAC,GAAGF,EAAE;IAC9C,OAAOE,QAAQ;EACjB,CAAC,CAAC;EACF,OAAO;IACL,GAAGzD,CAAC;IACJoD,eAAe,EAAEC,qBAAqB;IACtCK,qBAAqB,EAAE;EACzB,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_pieConfigureEvents","_mathRendering","_main","_defaults","CategorizeConfigure","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","defaults","configuration","model","m","choices","length","maxAnswerChoices","console","warn","render","c","newConfiguration","language","enabled","languageChoices","options","value","settings","find","option","push","label","onModelChanged","dispatchEvent","ModelUpdatedEvent","onConfigurationChanged","connectedCallback","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","el","React","createElement","Main","bind","imageSupport","add","delete","uploadSoundSupport","createRoot","setTimeout","renderMath","disconnectedCallback","unmount","exports","default","_defineProperty2","correctResponse","mappedCorrectResponse","map","cr","alternateResponses","response","allowAlternateEnabled"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport Main from './main';\n\nimport defaults from './defaults';\n\nexport default class CategorizeConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => ({\n ...defaults.model,\n ...model,\n });\n\n // PD-2960: make sure we don't have alternates in model or possibility to add them (temporary solution)\n // this function is used in controller, too\n static disableAlternateResponses = (m) => {\n let { correctResponse } = m || {};\n correctResponse = correctResponse || [];\n const mappedCorrectResponse = correctResponse.map((cr) => {\n const { alternateResponses, ...response } = cr;\n return response;\n });\n return {\n ...m,\n correctResponse: mappedCorrectResponse,\n allowAlternateEnabled: false,\n };\n };\n\n constructor() {\n super();\n this._root = null;\n this._model = CategorizeConfigure.createDefaultModel();\n this._configuration = defaults.configuration;\n }\n\n set model(m) {\n this._model = CategorizeConfigure.createDefaultModel(m);\n\n if (m.choices && m.choices.length >= m.maxAnswerChoices) {\n this._model.maxAnswerChoices = m.choices.length;\n console.warn(\"Max Answer Choices can't be less than choices length!\");\n }\n\n this.render();\n }\n\n set configuration(c) {\n const newConfiguration = {\n ...defaults.configuration,\n ...c,\n };\n\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this.render();\n }\n\n onModelChanged(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n this.render();\n }\n\n connectedCallback() {\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n const el = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n\n setTimeout(() => {\n renderMath(this);\n }, 0);\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAOA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEe,MAAMM,mBAAmB,SAASC,WAAW,CAAC;EAsB3DC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CAACC,MAAM,GAAGJ,mBAAmB,CAACK,kBAAkB,CAAC,CAAC;IACtD,IAAI,CAACC,cAAc,GAAGC,iBAAQ,CAACC,aAAa;EAC9C;EAEA,IAAIC,KAAKA,CAACC,CAAC,EAAE;IACX,IAAI,CAACN,MAAM,GAAGJ,mBAAmB,CAACK,kBAAkB,CAACK,CAAC,CAAC;IAEvD,IAAIA,CAAC,CAACC,OAAO,IAAID,CAAC,CAACC,OAAO,CAACC,MAAM,IAAIF,CAAC,C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AAmB,+BAQFU,CAAC,IAAK;EACxC,IAAI;IAAEoD;EAAgB,CAAC,GAAGpD,CAAC,IAAI,CAAC,CAAC;EACjCoD,eAAe,GAAGA,eAAe,IAAI,EAAE;EACvC,MAAMC,qBAAqB,GAAGD,eAAe,CAACE,GAAG,CAAEC,EAAE,IAAK;IACxD,MAAM;MAAEC,kBAAkB;MAAE,GAAGC;IAAS,CAAC,GAAGF,EAAE;IAC9C,OAAOE,QAAQ;EACjB,CAAC,CAAC;EACF,OAAO;IACL,GAAGzD,CAAC;IACJoD,eAAe,EAAEC,qBAAqB;IACtCK,qBAAqB,EAAE;EACzB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -16,11 +16,11 @@
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-configure-events": "^1.3.0",
18
18
  "@pie-lib/categorize": "2.0.2",
19
- "@pie-lib/config-ui": "13.0.5",
20
- "@pie-lib/drag": "4.0.3",
21
- "@pie-lib/editable-html-tip-tap": "2.1.3",
19
+ "@pie-lib/config-ui": "13.0.7",
20
+ "@pie-lib/drag": "4.0.4",
21
+ "@pie-lib/editable-html-tip-tap": "2.1.5",
22
22
  "@pie-lib/math-rendering": "5.0.2",
23
- "@pie-lib/render-ui": "6.1.1",
23
+ "@pie-lib/render-ui": "6.1.2",
24
24
  "@pie-lib/translator": "4.0.2",
25
25
  "debug": "^4.1.1",
26
26
  "lodash-es": "^4.17.23",
@@ -185,6 +185,20 @@ const model = async (question, session, env, updateSession) => {
185
185
  if (!lockChoiceOrder) {
186
186
  choices = await (0, _controllerUtils.getShuffledChoices)(choices, session, updateSession, 'id');
187
187
  }
188
+ choices = (choices || []).map(c => {
189
+ let categoryCount;
190
+ if (normalizedQuestion.allowMultiplePlacementsEnabled === _utils.multiplePlacements.enabled) {
191
+ categoryCount = 0;
192
+ } else if (normalizedQuestion.allowMultiplePlacementsEnabled === _utils.multiplePlacements.disabled) {
193
+ categoryCount = 1;
194
+ } else {
195
+ categoryCount = c.categoryCount || 0;
196
+ }
197
+ return {
198
+ ...c,
199
+ categoryCount
200
+ };
201
+ });
188
202
  if (!note) {
189
203
  note = translator.t('common:commonCorrectAnswerWithAlternates', {
190
204
  lng: language
@@ -260,7 +274,7 @@ const getLogTrace = (model, session, env) => {
260
274
  const builtCategories = builtState?.categories || [];
261
275
  if (draggedChoices > 0) {
262
276
  traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);
263
- (categories || []).forEach((category, categoryIndex) => {
277
+ (categories || []).forEach(category => {
264
278
  const categoryId = category.id;
265
279
  const builtCategory = builtCategories.find(c => c.id === categoryId);
266
280
  const studentChoices = builtCategory ? builtCategory.choices || [] : [];
@@ -289,11 +303,11 @@ const getLogTrace = (model, session, env) => {
289
303
  traceLog.push(`Alternate response combinations are accepted for this question.`);
290
304
  }
291
305
  if (hasAlternates) {
292
- traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);
293
- traceLog.push(`Student must get all categories completely correct to receive full credit.`);
306
+ traceLog.push('Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).');
307
+ traceLog.push('Student must get all categories completely correct to receive full credit.');
294
308
  } else if (partialScoringEnabled) {
295
- traceLog.push(`Score calculated using partial scoring.`);
296
- traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);
309
+ traceLog.push('Score calculated using partial scoring.');
310
+ traceLog.push('Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.');
297
311
  if (draggedChoices > 0) {
298
312
  const totalCorrect = builtCategories.reduce((sum, cat) => sum + (cat.choices || []).filter(choice => choice.correct).length, 0);
299
313
  const totalIncorrect = draggedChoices - totalCorrect;
@@ -305,8 +319,8 @@ const getLogTrace = (model, session, env) => {
305
319
  }
306
320
  }
307
321
  } else {
308
- traceLog.push(`Score calculated using all-or-nothing scoring.`);
309
- traceLog.push(`Student must get all categories completely correct to receive full credit.`);
322
+ traceLog.push('Score calculated using all-or-nothing scoring.');
323
+ traceLog.push('Student must get all categories completely correct to receive full credit.');
310
324
  }
311
325
  const score = getTotalScore(model, session, env);
312
326
  traceLog.push(`Final score: ${score}.`);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodashEs","require","_categorize","_feedback","_controllerUtils","_translator","_interopRequireDefault","_defaults","_utils","translator","Translator","getPartialScore","correctResponse","builtCategories","placements","score","reduce","acc","choices","length","filter","ch","correct","maxScore","extraPlacements","totalScore","parseFloat","toFixed","exports","getAlternates","map","c","alternateResponses","alternate","getTotalScore","question","session","env","Object","keys","categories","answers","buildState","alternates","enabled","partialScoring","getCorrectness","Promise","resolve","mode","undefined","createDefaultModel","model","defaults","normalize","updateSession","normalizedQuestion","answerCorrectness","role","categoriesPerRow","choicesLabel","choicesPosition","feedback","feedbackEnabled","promptEnabled","prompt","rowLabels","rationaleEnabled","rationale","teacherInstructionsEnabled","teacherInstructions","language","maxChoicesPerCategory","extraCSSRules","minRowHeight","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","note","fb","lockChoiceOrder","lockChoices","filteredCorrectResponse","response","filteredChoices","choice","getFeedbackForCorrectness","getShuffledChoices","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","disabled","showNote","getLogTrace","traceLog","draggedChoices","sum","a","hasAlternates","partialScoringEnabled","builtState","push","forEach","category","categoryIndex","categoryId","id","builtCategory","find","studentChoices","correctResponseForCategory","cr","expectedChoices","correctCount","incorrectCount","totalCorrect","cat","totalIncorrect","maxPossible","outcome","reject","Error","isEmpty","empty","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","config","maxAnswerChoices","minChoices","minCategories","maxCategories","maxLengthPerChoice","maxLengthPerCategory","reversedChoices","reverse","errors","choicesErrors","categoriesErrors","field","required","label","index","content","identicalAnswer","slice","some","nbOfCategories","nbOfChoices","categoriesError","choicesError","hasAssociations","duplicateAlternateIndex","duplicateCategory","isCorrectResponseDuplicated","isAlternateDuplicated","duplicateAlternate","associationError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { buildState, score } from '@pie-lib/categorize';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\nimport defaults from './defaults';\nimport { getCompleteResponseDetails, isAlternateDuplicated, isCorrectResponseDuplicated } from './utils';\n\n// eslint-disable-next-line no-console\n\nexport { score };\n\nexport const getPartialScore = (correctResponse, builtCategories) => {\n // in the resulted best scenario we make a sum with all the correct responses\n // and all the placements\n const { placements, score } = builtCategories.reduce(\n (acc, { choices = [] }) => ({\n placements: acc.placements + choices.length,\n score: acc.score + choices.filter((ch) => ch.correct).length,\n }),\n { placements: 0, score: 0 },\n );\n\n // in the correct response, we make a sum of the max possible score\n const { maxScore } = correctResponse.reduce(\n (acc, { choices }) => ({\n maxScore: acc.maxScore + choices.length,\n }),\n { maxScore: 0 },\n );\n\n // if there are any extra placements, we subtract from the obtained score\n const extraPlacements = placements > maxScore ? placements - maxScore : 0;\n const totalScore = (score - extraPlacements) / maxScore;\n\n return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));\n};\n\nconst getAlternates = (correctResponse) =>\n correctResponse.map((c) => c.alternateResponses).filter((alternate) => alternate);\n\nexport const getTotalScore = (question, session, env) => {\n if (!session) {\n return 0;\n }\n\n if (Object.keys(session).length === 0) {\n return 0;\n }\n const { categories, choices } = question || {};\n let { correctResponse } = question || {};\n let { answers } = session || {};\n answers = answers || [];\n correctResponse = correctResponse || [];\n\n // this function is used in pie-ui/categorize as well, in order to get the best scenario\n // so we get the best scenario and calculate the score\n const { categories: builtCategories, correct } = buildState(categories, choices, answers, correctResponse);\n\n const alternates = getAlternates(correctResponse);\n const enabled = partialScoring.enabled(question, env);\n\n // if there are any alternates, there will be no partial scoring!\n if (enabled && !alternates.length) {\n // we apply partial scoring\n return getPartialScore(correctResponse, builtCategories);\n }\n\n // else we apply dichotomous\n return correct ? 1 : 0;\n};\n\nexport const getCorrectness = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode === 'evaluate') {\n const score = getTotalScore(question, session, env);\n if (score === 1) {\n resolve('correct');\n } else if (score === 0) {\n resolve('incorrect');\n } else {\n resolve('partially-correct');\n }\n } else {\n resolve(undefined);\n }\n });\n};\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\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 const model = async (question, session, env, updateSession) => {\n const normalizedQuestion = normalize(question);\n const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);\n\n const { mode, role } = env || {};\n\n const {\n categories,\n categoriesPerRow,\n choicesLabel,\n choicesPosition,\n correctResponse,\n feedback,\n feedbackEnabled,\n promptEnabled,\n prompt,\n rowLabels,\n rationaleEnabled,\n rationale,\n teacherInstructionsEnabled,\n teacherInstructions,\n language,\n maxChoicesPerCategory,\n extraCSSRules,\n minRowHeight,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n let { choices, note } = normalizedQuestion;\n let fb;\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n const filteredCorrectResponse = correctResponse.map((response) => {\n const filteredChoices = (response.choices || []).filter((choice) => choice !== 'null');\n return { ...response, choices: filteredChoices };\n });\n\n if (mode === 'evaluate' && feedbackEnabled) {\n fb = await getFeedbackForCorrectness(answerCorrectness, feedback);\n }\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n if (!note) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: language });\n }\n\n const alternates = getAlternates(filteredCorrectResponse);\n const { responseAreasToBeFilled, possibleResponses, hasUnplacedChoices } = getCompleteResponseDetails(\n filteredCorrectResponse,\n normalizedQuestion.allowAlternateEnabled ? alternates : [],\n normalizedQuestion.choices,\n );\n const out = {\n categories: categories || [],\n categoriesPerRow: categoriesPerRow || 2,\n maxChoicesPerCategory,\n correctness: answerCorrectness,\n choices: choices || [],\n choicesLabel: choicesLabel || '',\n choicesPosition,\n disabled: mode !== 'gather',\n feedback: fb,\n lockChoiceOrder,\n prompt: promptEnabled ? prompt : null,\n rowLabels,\n note,\n env,\n showNote: alternates && alternates.length > 0,\n correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,\n language,\n extraCSSRules,\n fontSizeFactor,\n minRowHeight: minRowHeight,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n possibleResponses,\n responseAreasToBeFilled,\n hasUnplacedChoices,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = rationaleEnabled ? rationale : null;\n out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\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 { answers } = session || {};\n const { categories, choices, correctResponse } = model || {};\n\n const draggedChoices = answers.reduce(\n (sum, a) => sum + (a.choices?.length || 0),\n 0\n );\n\n const alternates = getAlternates(correctResponse);\n const hasAlternates = alternates.length > 0;\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n const builtState =\n draggedChoices > 0\n ? buildState(categories, choices, answers, correctResponse)\n : null;\n\n const builtCategories = builtState?.categories || [];\n \n if (draggedChoices > 0) {\n traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);\n \n (categories || []).forEach((category, categoryIndex) => {\n const categoryId = category.id;\n const builtCategory = builtCategories.find(c => c.id === categoryId);\n const studentChoices = builtCategory ? builtCategory.choices || [] : [];\n const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);\n const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];\n \n if (expectedChoices.length > 0) {\n if (studentChoices.length === 0) {\n traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);\n } else {\n const correctCount = studentChoices.filter(choice => choice.correct).length;\n const incorrectCount = studentChoices.length - correctCount;\n \n if (correctCount > 0 && incorrectCount === 0) {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);\n } else if (correctCount === 0 && incorrectCount > 0) {\n traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);\n } else {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);\n }\n }\n }\n });\n } else {\n traceLog.push('Student did not place any choices into categories.');\n }\n\n if (hasAlternates) {\n traceLog.push(`Alternate response combinations are accepted for this question.`);\n }\n\n if (hasAlternates) {\n traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n } else if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);\n \n if (draggedChoices > 0) {\n const totalCorrect = builtCategories.reduce((sum, cat) => \n sum + (cat.choices || []).filter(choice => choice.correct).length, 0);\n const totalIncorrect = draggedChoices - totalCorrect;\n const maxPossible = (correctResponse || []).reduce((sum, cat) => \n sum + (cat.choices || []).length, 0);\n \n traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);\n \n if (draggedChoices > maxPossible) {\n const extraPlacements = draggedChoices - maxPossible;\n traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);\n }\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n }\n\n const score = getTotalScore(model, session, env);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\nexport const outcome = (question, session, env) => {\n if (env.mode !== 'evaluate') {\n return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));\n } else {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not place any choices into categories. Score is 0.'],\n });\n } else {\n const traceLog = getLogTrace(question, session, env);\n const score = getTotalScore(question, session, env);\n \n resolve({\n score,\n empty: false,\n traceLog,\n });\n }\n });\n }\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n const { mode, role } = env || {};\n\n if (mode !== 'evaluate' && role === 'instructor') {\n const { correctResponse } = question;\n\n resolve({ answers: correctResponse, id: 1 });\n } else {\n return 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 { categories, choices, correctResponse, maxAnswerChoices } = model;\n const {\n minChoices = 1,\n minCategories = 1,\n maxCategories = 12,\n maxLengthPerChoice = 300,\n maxLengthPerCategory = 150,\n } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const categoriesErrors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n (categories || []).forEach((category) => {\n const { id, label } = category;\n\n if (getInnerText(label).length > maxLengthPerCategory) {\n categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;\n }\n });\n\n (reversedChoices || []).forEach((choice, index) => {\n const { id, content } = choice;\n\n if (getInnerText(content).length > maxLengthPerChoice) {\n choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;\n }\n\n if (!getContent(content)) {\n choicesErrors[id] = 'Tokens should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.content === content);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Tokens content should be unique.';\n }\n }\n });\n\n const nbOfCategories = (categories || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfCategories > maxCategories) {\n errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;\n } else if (nbOfCategories < minCategories) {\n errors.categoriesError = `There should be at least ${minCategories} category defined.`;\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (nbOfChoices && nbOfCategories) {\n let hasAssociations = false;\n\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [] } = response;\n\n if (choices.length) {\n hasAssociations = true;\n } else {\n alternateResponses.forEach((alternate) => {\n if ((alternate || []).length) {\n hasAssociations = true;\n }\n });\n }\n });\n\n let duplicateAlternateIndex = -1;\n let duplicateCategory = '';\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [], category } = response;\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isCorrectResponseDuplicated(choices, alternateResponses);\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isAlternateDuplicated(alternateResponses);\n }\n\n duplicateCategory = category;\n }\n });\n\n if (duplicateAlternateIndex > -1) {\n errors.duplicateAlternate = { index: duplicateAlternateIndex, category: duplicateCategory };\n }\n\n if (!hasAssociations) {\n errors.associationError = 'At least one token should be assigned to at least one category.';\n }\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n if (!isEmpty(categoriesErrors)) {\n errors.categoriesErrors = categoriesErrors;\n }\n\n return errors;\n};\n"],"mappings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AQ,IAAK;MAC5C,MAAM;QAAElE,OAAO,GAAG,EAAE;QAAEc,kBAAkB,GAAG,EAAE;QAAE8E;MAAS,CAAC,GAAG1B,QAAQ;MAEpE,IAAI+E,uBAAuB,KAAK,CAAC,CAAC,EAAE;QAClCA,uBAAuB,GAAG,IAAAE,kCAA2B,EAACnJ,OAAO,EAAEc,kBAAkB,CAAC;QAElF,IAAImI,uBAAuB,KAAK,CAAC,CAAC,EAAE;UAClCA,uBAAuB,GAAG,IAAAG,4BAAqB,EAACtI,kBAAkB,CAAC;QACrE;QAEAoI,iBAAiB,GAAGtD,QAAQ;MAC9B;IACF,CAAC,CAAC;IAEF,IAAIqD,uBAAuB,GAAG,CAAC,CAAC,EAAE;MAChChB,MAAM,CAACoB,kBAAkB,GAAG;QAAEd,KAAK,EAAEU,uBAAuB;QAAErD,QAAQ,EAAEsD;MAAkB,CAAC;IAC7F;IAEA,IAAI,CAACF,eAAe,EAAE;MACpBf,MAAM,CAACqB,gBAAgB,GAAG,iEAAiE;IAC7F;EACF;EAEA,IAAI,CAAC,IAAAvC,iBAAO,EAACmB,aAAa,CAAC,EAAE;IAC3BD,MAAM,CAACC,aAAa,GAAGA,aAAa;EACtC;EAEA,IAAI,CAAC,IAAAnB,iBAAO,EAACoB,gBAAgB,CAAC,EAAE;IAC9BF,MAAM,CAACE,gBAAgB,GAAGA,gBAAgB;EAC5C;EAEA,OAAOF,MAAM;AACf,CAAC;AAACvH,OAAA,CAAA6G,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodashEs","require","_categorize","_feedback","_controllerUtils","_translator","_interopRequireDefault","_defaults","_utils","translator","Translator","getPartialScore","correctResponse","builtCategories","placements","score","reduce","acc","choices","length","filter","ch","correct","maxScore","extraPlacements","totalScore","parseFloat","toFixed","exports","getAlternates","map","c","alternateResponses","alternate","getTotalScore","question","session","env","Object","keys","categories","answers","buildState","alternates","enabled","partialScoring","getCorrectness","Promise","resolve","mode","undefined","createDefaultModel","model","defaults","normalize","updateSession","normalizedQuestion","answerCorrectness","role","categoriesPerRow","choicesLabel","choicesPosition","feedback","feedbackEnabled","promptEnabled","prompt","rowLabels","rationaleEnabled","rationale","teacherInstructionsEnabled","teacherInstructions","language","maxChoicesPerCategory","extraCSSRules","minRowHeight","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","note","fb","lockChoiceOrder","lockChoices","filteredCorrectResponse","response","filteredChoices","choice","getFeedbackForCorrectness","getShuffledChoices","categoryCount","allowMultiplePlacementsEnabled","multiplePlacements","disabled","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","showNote","getLogTrace","traceLog","draggedChoices","sum","a","hasAlternates","partialScoringEnabled","builtState","push","forEach","category","categoryId","id","builtCategory","find","studentChoices","correctResponseForCategory","cr","expectedChoices","correctCount","incorrectCount","totalCorrect","cat","totalIncorrect","maxPossible","outcome","reject","Error","isEmpty","empty","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","config","maxAnswerChoices","minChoices","minCategories","maxCategories","maxLengthPerChoice","maxLengthPerCategory","reversedChoices","reverse","errors","choicesErrors","categoriesErrors","field","required","label","index","content","identicalAnswer","slice","some","nbOfCategories","nbOfChoices","categoriesError","choicesError","hasAssociations","duplicateAlternateIndex","duplicateCategory","isCorrectResponseDuplicated","isAlternateDuplicated","duplicateAlternate","associationError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { buildState, score } from '@pie-lib/categorize';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\nimport defaults from './defaults';\nimport { getCompleteResponseDetails, isAlternateDuplicated, isCorrectResponseDuplicated, multiplePlacements } from './utils';\n\n// eslint-disable-next-line no-console\n\nexport { score };\n\nexport const getPartialScore = (correctResponse, builtCategories) => {\n // in the resulted best scenario we make a sum with all the correct responses\n // and all the placements\n const { placements, score } = builtCategories.reduce(\n (acc, { choices = [] }) => ({\n placements: acc.placements + choices.length,\n score: acc.score + choices.filter((ch) => ch.correct).length,\n }),\n { placements: 0, score: 0 },\n );\n\n // in the correct response, we make a sum of the max possible score\n const { maxScore } = correctResponse.reduce(\n (acc, { choices }) => ({\n maxScore: acc.maxScore + choices.length,\n }),\n { maxScore: 0 },\n );\n\n // if there are any extra placements, we subtract from the obtained score\n const extraPlacements = placements > maxScore ? placements - maxScore : 0;\n const totalScore = (score - extraPlacements) / maxScore;\n\n return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));\n};\n\nconst getAlternates = (correctResponse) =>\n correctResponse.map((c) => c.alternateResponses).filter((alternate) => alternate);\n\nexport const getTotalScore = (question, session, env) => {\n if (!session) {\n return 0;\n }\n\n if (Object.keys(session).length === 0) {\n return 0;\n }\n const { categories, choices } = question || {};\n let { correctResponse } = question || {};\n let { answers } = session || {};\n answers = answers || [];\n correctResponse = correctResponse || [];\n\n // this function is used in pie-ui/categorize as well, in order to get the best scenario\n // so we get the best scenario and calculate the score\n const { categories: builtCategories, correct } = buildState(categories, choices, answers, correctResponse);\n\n const alternates = getAlternates(correctResponse);\n const enabled = partialScoring.enabled(question, env);\n\n // if there are any alternates, there will be no partial scoring!\n if (enabled && !alternates.length) {\n // we apply partial scoring\n return getPartialScore(correctResponse, builtCategories);\n }\n\n // else we apply dichotomous\n return correct ? 1 : 0;\n};\n\nexport const getCorrectness = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode === 'evaluate') {\n const score = getTotalScore(question, session, env);\n if (score === 1) {\n resolve('correct');\n } else if (score === 0) {\n resolve('incorrect');\n } else {\n resolve('partially-correct');\n }\n } else {\n resolve(undefined);\n }\n });\n};\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\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 const model = async (question, session, env, updateSession) => {\n const normalizedQuestion = normalize(question);\n const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);\n\n const { mode, role } = env || {};\n\n const {\n categories,\n categoriesPerRow,\n choicesLabel,\n choicesPosition,\n correctResponse,\n feedback,\n feedbackEnabled,\n promptEnabled,\n prompt,\n rowLabels,\n rationaleEnabled,\n rationale,\n teacherInstructionsEnabled,\n teacherInstructions,\n language,\n maxChoicesPerCategory,\n extraCSSRules,\n minRowHeight,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n let { choices, note } = normalizedQuestion;\n let fb;\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n const filteredCorrectResponse = correctResponse.map((response) => {\n const filteredChoices = (response.choices || []).filter((choice) => choice !== 'null');\n return { ...response, choices: filteredChoices };\n });\n\n if (mode === 'evaluate' && feedbackEnabled) {\n fb = await getFeedbackForCorrectness(answerCorrectness, feedback);\n }\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n choices = (choices || []).map((c) => {\n let categoryCount;\n if (normalizedQuestion.allowMultiplePlacementsEnabled === multiplePlacements.enabled) {\n categoryCount = 0;\n } else if (normalizedQuestion.allowMultiplePlacementsEnabled === multiplePlacements.disabled) {\n categoryCount = 1;\n } else {\n categoryCount = c.categoryCount || 0;\n }\n return { ...c, categoryCount };\n });\n\n if (!note) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: language });\n }\n\n const alternates = getAlternates(filteredCorrectResponse);\n const { responseAreasToBeFilled, possibleResponses, hasUnplacedChoices } = getCompleteResponseDetails(\n filteredCorrectResponse,\n normalizedQuestion.allowAlternateEnabled ? alternates : [],\n normalizedQuestion.choices,\n );\n const out = {\n categories: categories || [],\n categoriesPerRow: categoriesPerRow || 2,\n maxChoicesPerCategory,\n correctness: answerCorrectness,\n choices: choices || [],\n choicesLabel: choicesLabel || '',\n choicesPosition,\n disabled: mode !== 'gather',\n feedback: fb,\n lockChoiceOrder,\n prompt: promptEnabled ? prompt : null,\n rowLabels,\n note,\n env,\n showNote: alternates && alternates.length > 0,\n correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,\n language,\n extraCSSRules,\n fontSizeFactor,\n minRowHeight: minRowHeight,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n possibleResponses,\n responseAreasToBeFilled,\n hasUnplacedChoices,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = rationaleEnabled ? rationale : null;\n out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\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 { answers } = session || {};\n const { categories, choices, correctResponse } = model || {};\n\n const draggedChoices = answers.reduce(\n (sum, a) => sum + (a.choices?.length || 0),\n 0\n );\n\n const alternates = getAlternates(correctResponse);\n const hasAlternates = alternates.length > 0;\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n const builtState =\n draggedChoices > 0\n ? buildState(categories, choices, answers, correctResponse)\n : null;\n\n const builtCategories = builtState?.categories || [];\n \n if (draggedChoices > 0) {\n traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);\n \n (categories || []).forEach((category) => {\n const categoryId = category.id;\n const builtCategory = builtCategories.find(c => c.id === categoryId);\n const studentChoices = builtCategory ? builtCategory.choices || [] : [];\n const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);\n const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];\n \n if (expectedChoices.length > 0) {\n if (studentChoices.length === 0) {\n traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);\n } else {\n const correctCount = studentChoices.filter(choice => choice.correct).length;\n const incorrectCount = studentChoices.length - correctCount;\n \n if (correctCount > 0 && incorrectCount === 0) {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);\n } else if (correctCount === 0 && incorrectCount > 0) {\n traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);\n } else {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);\n }\n }\n }\n });\n } else {\n traceLog.push('Student did not place any choices into categories.');\n }\n\n if (hasAlternates) {\n traceLog.push(`Alternate response combinations are accepted for this question.`);\n }\n\n if (hasAlternates) {\n traceLog.push('Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).');\n traceLog.push('Student must get all categories completely correct to receive full credit.');\n } else if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push('Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.');\n \n if (draggedChoices > 0) {\n const totalCorrect = builtCategories.reduce((sum, cat) => \n sum + (cat.choices || []).filter(choice => choice.correct).length, 0);\n const totalIncorrect = draggedChoices - totalCorrect;\n const maxPossible = (correctResponse || []).reduce((sum, cat) => \n sum + (cat.choices || []).length, 0);\n \n traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);\n \n if (draggedChoices > maxPossible) {\n const extraPlacements = draggedChoices - maxPossible;\n traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);\n }\n }\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push('Student must get all categories completely correct to receive full credit.');\n }\n\n const score = getTotalScore(model, session, env);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\nexport const outcome = (question, session, env) => {\n if (env.mode !== 'evaluate') {\n return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));\n } else {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not place any choices into categories. Score is 0.'],\n });\n } else {\n const traceLog = getLogTrace(question, session, env);\n const score = getTotalScore(question, session, env);\n \n resolve({\n score,\n empty: false,\n traceLog,\n });\n }\n });\n }\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n const { mode, role } = env || {};\n\n if (mode !== 'evaluate' && role === 'instructor') {\n const { correctResponse } = question;\n\n resolve({ answers: correctResponse, id: 1 });\n } else {\n return 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 { categories, choices, correctResponse, maxAnswerChoices } = model;\n const {\n minChoices = 1,\n minCategories = 1,\n maxCategories = 12,\n maxLengthPerChoice = 300,\n maxLengthPerCategory = 150,\n } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const categoriesErrors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n (categories || []).forEach((category) => {\n const { id, label } = category;\n\n if (getInnerText(label).length > maxLengthPerCategory) {\n categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;\n }\n });\n\n (reversedChoices || []).forEach((choice, index) => {\n const { id, content } = choice;\n\n if (getInnerText(content).length > maxLengthPerChoice) {\n choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;\n }\n\n if (!getContent(content)) {\n choicesErrors[id] = 'Tokens should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.content === content);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Tokens content should be unique.';\n }\n }\n });\n\n const nbOfCategories = (categories || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfCategories > maxCategories) {\n errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;\n } else if (nbOfCategories < minCategories) {\n errors.categoriesError = `There should be at least ${minCategories} category defined.`;\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (nbOfChoices && nbOfCategories) {\n let hasAssociations = false;\n\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [] } = response;\n\n if (choices.length) {\n hasAssociations = true;\n } else {\n alternateResponses.forEach((alternate) => {\n if ((alternate || []).length) {\n hasAssociations = true;\n }\n });\n }\n });\n\n let duplicateAlternateIndex = -1;\n let duplicateCategory = '';\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [], category } = response;\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isCorrectResponseDuplicated(choices, alternateResponses);\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isAlternateDuplicated(alternateResponses);\n }\n\n duplicateCategory = category;\n }\n });\n\n if (duplicateAlternateIndex > -1) {\n errors.duplicateAlternate = { index: duplicateAlternateIndex, category: duplicateCategory };\n }\n\n if (!hasAssociations) {\n errors.associationError = 'At least one token should be assigned to at least one category.';\n }\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n if (!isEmpty(categoriesErrors)) {\n errors.categoriesErrors = categoriesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA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ignoreList":[]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "13.1.1-next.11+84119e88b",
7
+ "version": "13.1.1-next.31+f43e9b45c",
8
8
  "description": "",
9
9
  "author": "pie framework developers",
10
10
  "license": "ISC",
@@ -16,11 +16,11 @@
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-player-events": "^0.1.0",
18
18
  "@pie-lib/categorize": "2.0.2",
19
- "@pie-lib/config-ui": "13.0.5",
20
- "@pie-lib/correct-answer-toggle": "4.0.3",
21
- "@pie-lib/drag": "4.0.3",
19
+ "@pie-lib/config-ui": "13.0.7",
20
+ "@pie-lib/correct-answer-toggle": "4.0.4",
21
+ "@pie-lib/drag": "4.0.4",
22
22
  "@pie-lib/math-rendering": "5.0.2",
23
- "@pie-lib/render-ui": "6.1.1",
23
+ "@pie-lib/render-ui": "6.1.2",
24
24
  "@pie-lib/translator": "4.0.2",
25
25
  "debug": "^4.1.1",
26
26
  "lodash-es": "^4.17.23",
@@ -28,7 +28,7 @@
28
28
  "react": "18.3.1",
29
29
  "react-dom": "18.3.1"
30
30
  },
31
- "gitHead": "84119e88bfc3869f06f03cb7d63655060d30db73",
31
+ "gitHead": "f43e9b45ca148fbbe7b3e38ee1b5728a1f8a59d8",
32
32
  "scripts": {
33
33
  "postpublish": "../../scripts/postpublish"
34
34
  },