@pie-element/charting 5.11.2-next.45 → 5.11.3-next.105

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/charting-configure",
3
3
  "private": true,
4
- "version": "5.8.1",
4
+ "version": "5.8.2",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -9,9 +9,9 @@
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-framework/pie-configure-events": "^1.3.0",
12
- "@pie-lib/charting": "^5.8.0",
13
- "@pie-lib/config-ui": "^11.6.6",
14
- "@pie-lib/editable-html": "^9.5.25",
12
+ "@pie-lib/charting": "^5.9.0",
13
+ "@pie-lib/config-ui": "^11.6.9",
14
+ "@pie-lib/editable-html": "^9.6.1",
15
15
  "@pie-lib/math-rendering": "^2.5.14",
16
16
  "classnames": "^2.2.5",
17
17
  "debug": "^4.1.1",
@@ -3,6 +3,17 @@
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
+ ## [2.4.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.4.1...@pie-element/charting-controller@2.4.2) (2023-04-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-libs PD-2762 ([7ac4313](https://github.com/pie-framework/pie-elements/commit/7ac431346b822fe3bbb0d13375f044f6ce1f426b))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.4.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.4.0...@pie-element/charting-controller@2.4.1) (2023-04-10)
7
18
 
8
19
 
@@ -201,7 +201,6 @@ function model(question, session, env) {
201
201
  return new Promise(function (resolve) {
202
202
  var normalizedQuestion = normalize(question);
203
203
  var addCategoryEnabled = normalizedQuestion.addCategoryEnabled,
204
- categoryDefaultLabel = normalizedQuestion.categoryDefaultLabel,
205
204
  chartType = normalizedQuestion.chartType,
206
205
  data = normalizedQuestion.data,
207
206
  domain = normalizedQuestion.domain,
@@ -215,14 +214,14 @@ function model(question, session, env) {
215
214
  teacherInstructions = normalizedQuestion.teacherInstructions,
216
215
  teacherInstructionsEnabled = normalizedQuestion.teacherInstructionsEnabled,
217
216
  correctAnswer = normalizedQuestion.correctAnswer,
218
- scoringType = normalizedQuestion.scoringType;
217
+ scoringType = normalizedQuestion.scoringType,
218
+ studentCategoryDefaultLabel = normalizedQuestion.studentCategoryDefaultLabel;
219
219
  var correctInfo = {
220
220
  correctness: 'incorrect',
221
221
  score: '0%'
222
222
  };
223
223
  var base = {
224
224
  addCategoryEnabled: addCategoryEnabled,
225
- categoryDefaultLabel: categoryDefaultLabel,
226
225
  chartType: chartType,
227
226
  data: filterCategories(data),
228
227
  domain: domain,
@@ -234,7 +233,8 @@ function model(question, session, env) {
234
233
  size: graph,
235
234
  correctness: correctInfo,
236
235
  disabled: env.mode !== 'gather',
237
- scoringType: scoringType
236
+ scoringType: scoringType,
237
+ studentCategoryDefaultLabel: studentCategoryDefaultLabel
238
238
  };
239
239
  var answers = filterCategories(getScore(normalizedQuestion, session, env).answers);
240
240
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","deletable","rest","model","Promise","resolve","normalizedQuestion","categoryDefaultLabel","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","correctInfo","base","size","disabled","mode","correctedAnswer","role","outcome","empty","createCorrectResponseSession","id","validate","correctData","errors","correctAnswerErrors","categoryErrors","category","identicalAnswer","some","c","categoriesError","identicalError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD;AAAA,SAAY,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAZ;AAAA,CAAlB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV;AAAA,SAC5BD,OAAO,GACHA,OAAO,CAACE,GAAR,CAAY,UAACC,MAAD;AAAA,2CACPA,MADO;AAEVC,MAAAA,WAAW,EAAE;AACXC,QAAAA,KAAK,EAAEJ,cAAc,GAAG,WAAH,GAAiB,SAD3B;AAEXK,QAAAA,KAAK,EAAEL,cAAc,GAAG,WAAH,GAAiB;AAF3B;AAFH;AAAA,GAAZ,CADG,GAQH,EATwB;AAAA,CAAvB;;;;AAWA,IAAMM,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA;AACvBC,IAAAA,kBAAkB,EAAE,IADG;AAEvBC,IAAAA,aAAa,EAAE,IAFQ;AAGvBC,IAAAA,gBAAgB,EAAE,IAHK;AAIvBC,IAAAA,0BAA0B,EAAE,IAJL;AAKvBC,IAAAA,0BAA0B,EAAE;AALL,KAMpBL,QANoB;AAAA,CAAlB;;;;AASA,IAAMM,QAAQ,GAAG,SAAXA,QAAW,CAACN,QAAD,EAAWO,OAAX,EAAiC;AAAA,MAAbC,GAAa,uEAAP,EAAO;AACvD,MAAQC,aAAR,GA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AAK,aAA9B,EAA6C;AAC3CkE,MAAAA,cAAc,CAACvC,KAAD,CAAd,GAAwB,8BAAxB;AACD,KAFD,MAEO;AACL,UAAMyC,eAAe,GAAGjC,UAAU,CAACH,KAAX,CAAiBL,KAAK,GAAG,CAAzB,EAA4B0C,IAA5B,CAAiC,UAACC,CAAD;AAAA,eAAOA,CAAC,CAACtE,KAAF,KAAYA,KAAnB;AAAA,OAAjC,CAAxB;;AAEA,UAAIoE,eAAJ,EAAqB;AACnBF,QAAAA,cAAc,CAACvC,KAAK,GAAG,CAAT,CAAd,GAA4B,2BAA5B;AACD;AACF;AACF,GAZD;;AAcA,MAAIQ,UAAU,CAACJ,MAAX,GAAoB,CAApB,IAAyBI,UAAU,CAACJ,MAAX,GAAoB,EAAjD,EAAqD;AACnDkC,IAAAA,mBAAmB,CAACM,eAApB,GAAsC,gEAAtC;AACD,GAFD,MAEO,IACL,yBACE3D,IAAI,CAAChB,GAAL,CAAS,UAACuE,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAT,CADF,EAEEJ,WAAW,CAACnE,GAAZ,CAAgB,UAACuE,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAhB,CAFF,CADK,EAKL;AACAF,IAAAA,mBAAmB,CAACO,cAApB,GAAqC,qEAArC;AACD;;AAED,MAAI,CAAC,yBAAQN,cAAR,CAAL,EAA8B;AAC5BF,IAAAA,MAAM,CAACE,cAAP,GAAwBA,cAAxB;AACD;;AAED,MAAI,CAAC,yBAAQD,mBAAR,CAAL,EAAmC;AACjCD,IAAAA,MAAM,CAACC,mBAAP,GAA6BA,mBAA7B;AACD;;AAED,SAAOD,MAAP;AACD,CA3CM","sourcesContent":["import debug from 'debug';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = (string) => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) =>\n answers\n ? answers.map((answer) => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct',\n },\n }))\n : [];\n\nexport const normalize = (question) => ({\n addCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env,\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true),\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers,\n };\n};\n\n// eslint-disable-next-line no-unused-vars\nexport const filterCategories = (categories) => (categories ? categories.map(({ deletable, ...rest }) => rest) : []);\n\nexport function model(question, session, env) {\n return new Promise((resolve) => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data,\n domain,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType,\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data: filterCategories(data),\n domain,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType,\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers);\n\n if (env.mode === 'view') {\n // eslint-disable-next-line no-unused-vars\n base.correctedAnswer = answers.map(({ correctness, ...rest }) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session),\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n let answers = correctAnswer && correctAnswer.data;\n\n // for IBX preview mode\n if (env.mode === 'gather') {\n const { data } = question;\n\n answers = ((correctAnswer && correctAnswer.data) || []).map((answer, index) => {\n return {\n ...data[index],\n ...answer,\n };\n });\n }\n\n resolve({\n answer: answers,\n id: '1',\n });\n } else {\n return resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}) => {\n const { correctAnswer, data } = model || {};\n const { data: correctData } = correctAnswer || {};\n const categories = correctData || [];\n\n const errors = {};\n const correctAnswerErrors = {};\n const categoryErrors = {};\n\n categories.forEach((category, index) => {\n const { label } = category;\n\n if (label === '' || label === '<div></div>') {\n categoryErrors[index] = 'Content should not be empty.';\n } else {\n const identicalAnswer = categories.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n categoryErrors[index + 1] = 'Content should be unique.';\n }\n }\n });\n\n if (categories.length < 1 || categories.length > 20) {\n correctAnswerErrors.categoriesError = 'The correct answer should include between 1 and 20 categories.';\n } else if (\n isEqual(\n data.map((category) => pick(category, 'value', 'label')),\n correctData.map((category) => pick(category, 'value', 'label')),\n )\n ) {\n correctAnswerErrors.identicalError = 'Correct answer should not be identical to the chart’s initial state';\n }\n\n if (!isEmpty(categoryErrors)) {\n errors.categoryErrors = categoryErrors;\n }\n\n if (!isEmpty(correctAnswerErrors)) {\n errors.correctAnswerErrors = correctAnswerErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","deletable","rest","model","Promise","resolve","normalizedQuestion","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","studentCategoryDefaultLabel","correctInfo","base","size","disabled","mode","correctedAnswer","role","outcome","empty","createCorrectResponseSession","id","validate","correctData","errors","correctAnswerErrors","categoryErrors","category","identicalAnswer","some","c","categoriesError","identicalError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD;AAAA,SAAY,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAZ;AAAA,CAAlB;;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AAG,CAAT,CAAd,GAA4B,2BAA5B;AACD;AACF;AACF,GAZD;;AAcA,MAAIQ,UAAU,CAACJ,MAAX,GAAoB,CAApB,IAAyBI,UAAU,CAACJ,MAAX,GAAoB,EAAjD,EAAqD;AACnDkC,IAAAA,mBAAmB,CAACM,eAApB,GAAsC,gEAAtC;AACD,GAFD,MAEO,IACL,yBACE3D,IAAI,CAAChB,GAAL,CAAS,UAACuE,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAT,CADF,EAEEJ,WAAW,CAACnE,GAAZ,CAAgB,UAACuE,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAhB,CAFF,CADK,EAKL;AACAF,IAAAA,mBAAmB,CAACO,cAApB,GAAqC,qEAArC;AACD;;AAED,MAAI,CAAC,yBAAQN,cAAR,CAAL,EAA8B;AAC5BF,IAAAA,MAAM,CAACE,cAAP,GAAwBA,cAAxB;AACD;;AAED,MAAI,CAAC,yBAAQD,mBAAR,CAAL,EAAmC;AACjCD,IAAAA,MAAM,CAACC,mBAAP,GAA6BA,mBAA7B;AACD;;AAED,SAAOD,MAAP;AACD,CA3CM","sourcesContent":["import debug from 'debug';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = (string) => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) =>\n answers\n ? answers.map((answer) => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct',\n },\n }))\n : [];\n\nexport const normalize = (question) => ({\n addCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env,\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true),\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers,\n };\n};\n\n// eslint-disable-next-line no-unused-vars\nexport const filterCategories = (categories) => (categories ? categories.map(({ deletable, ...rest }) => rest) : []);\n\nexport function model(question, session, env) {\n return new Promise((resolve) => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n chartType,\n data,\n domain,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType,\n studentCategoryDefaultLabel,\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n chartType,\n data: filterCategories(data),\n domain,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType,\n studentCategoryDefaultLabel,\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers);\n\n if (env.mode === 'view') {\n // eslint-disable-next-line no-unused-vars\n base.correctedAnswer = answers.map(({ correctness, ...rest }) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session),\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n let answers = correctAnswer && correctAnswer.data;\n\n // for IBX preview mode\n if (env.mode === 'gather') {\n const { data } = question;\n\n answers = ((correctAnswer && correctAnswer.data) || []).map((answer, index) => {\n return {\n ...data[index],\n ...answer,\n };\n });\n }\n\n resolve({\n answer: answers,\n id: '1',\n });\n } else {\n return resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}) => {\n const { correctAnswer, data } = model || {};\n const { data: correctData } = correctAnswer || {};\n const categories = correctData || [];\n\n const errors = {};\n const correctAnswerErrors = {};\n const categoryErrors = {};\n\n categories.forEach((category, index) => {\n const { label } = category;\n\n if (label === '' || label === '<div></div>') {\n categoryErrors[index] = 'Content should not be empty.';\n } else {\n const identicalAnswer = categories.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n categoryErrors[index + 1] = 'Content should be unique.';\n }\n }\n });\n\n if (categories.length < 1 || categories.length > 20) {\n correctAnswerErrors.categoriesError = 'The correct answer should include between 1 and 20 categories.';\n } else if (\n isEqual(\n data.map((category) => pick(category, 'value', 'label')),\n correctData.map((category) => pick(category, 'value', 'label')),\n )\n ) {\n correctAnswerErrors.identicalError = 'Correct answer should not be identical to the chart’s initial state';\n }\n\n if (!isEmpty(categoryErrors)) {\n errors.categoryErrors = categoryErrors;\n }\n\n if (!isEmpty(correctAnswerErrors)) {\n errors.correctAnswerErrors = correctAnswerErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/charting-controller",
3
3
  "private": true,
4
- "version": "2.4.1",
4
+ "version": "2.4.2",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -182,6 +182,48 @@
182
182
  }
183
183
  }
184
184
  },
185
+ "authorNewCategoryDefaults": {
186
+ "title": "AuthorNewCategoryDefaults",
187
+ "type": "object",
188
+ "properties": {
189
+ "settings": {
190
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
191
+ "type": "boolean",
192
+ "title": "settings"
193
+ },
194
+ "label": {
195
+ "description": "Indicates the label for the new category",
196
+ "type": "string",
197
+ "title": "label"
198
+ },
199
+ "interactive": {
200
+ "description": "Indicates if new category is interactive",
201
+ "type": "boolean",
202
+ "title": "interactive"
203
+ },
204
+ "editable": {
205
+ "description": "Indicates if new category is editable",
206
+ "type": "boolean",
207
+ "title": "editable"
208
+ }
209
+ }
210
+ },
211
+ "studentNewCategoryDefaultLabel": {
212
+ "title": "ConfigureProp",
213
+ "type": "object",
214
+ "properties": {
215
+ "settings": {
216
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
217
+ "type": "boolean",
218
+ "title": "settings"
219
+ },
220
+ "label": {
221
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
222
+ "type": "string",
223
+ "title": "label"
224
+ }
225
+ }
226
+ },
185
227
  "maxImageWidth": {
186
228
  "title": "ConfigureMaxImageDimensionsProp",
187
229
  "type": "object",
@@ -240,6 +282,75 @@
240
282
  }
241
283
  }
242
284
  },
285
+ "chartingOptions": {
286
+ "title": "ChartingOptions",
287
+ "type": "object",
288
+ "properties": {
289
+ "changeInteractive": {
290
+ "title": "ChartingOption",
291
+ "type": "object",
292
+ "properties": {
293
+ "settings": {
294
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
295
+ "type": "boolean",
296
+ "title": "settings"
297
+ },
298
+ "authoringLabel": {
299
+ "description": "Indicates the label for the option",
300
+ "type": "string",
301
+ "title": "authoringLabel"
302
+ },
303
+ "settingsLabel": {
304
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
305
+ "type": "string",
306
+ "title": "settingsLabel"
307
+ }
308
+ }
309
+ },
310
+ "changeEditable": {
311
+ "title": "ChartingOption",
312
+ "type": "object",
313
+ "properties": {
314
+ "settings": {
315
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
316
+ "type": "boolean",
317
+ "title": "settings"
318
+ },
319
+ "authoringLabel": {
320
+ "description": "Indicates the label for the option",
321
+ "type": "string",
322
+ "title": "authoringLabel"
323
+ },
324
+ "settingsLabel": {
325
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
326
+ "type": "string",
327
+ "title": "settingsLabel"
328
+ }
329
+ }
330
+ },
331
+ "addCategory": {
332
+ "title": "ChartingOption",
333
+ "type": "object",
334
+ "properties": {
335
+ "settings": {
336
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
337
+ "type": "boolean",
338
+ "title": "settings"
339
+ },
340
+ "authoringLabel": {
341
+ "description": "Indicates the label for the option",
342
+ "type": "string",
343
+ "title": "authoringLabel"
344
+ },
345
+ "settingsLabel": {
346
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
347
+ "type": "string",
348
+ "title": "settingsLabel"
349
+ }
350
+ }
351
+ }
352
+ }
353
+ },
243
354
  "showPrompt": {
244
355
  "description": "Determines whether prompt field will be displayed or not",
245
356
  "default": true,
@@ -303,6 +414,10 @@
303
414
  "title": "settingsPartialScoring"
304
415
  }
305
416
  },
417
+ "required": [
418
+ "authorNewCategoryDefaults",
419
+ "studentNewCategoryDefaultLabel"
420
+ ],
306
421
  "definitions": {
307
422
  "ConfigureProp": {
308
423
  "title": "ConfigureProp",
@@ -382,6 +497,32 @@
382
497
  }
383
498
  }
384
499
  },
500
+ "AuthorNewCategoryDefaults": {
501
+ "title": "AuthorNewCategoryDefaults",
502
+ "type": "object",
503
+ "properties": {
504
+ "settings": {
505
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
506
+ "type": "boolean",
507
+ "title": "settings"
508
+ },
509
+ "label": {
510
+ "description": "Indicates the label for the new category",
511
+ "type": "string",
512
+ "title": "label"
513
+ },
514
+ "interactive": {
515
+ "description": "Indicates if new category is interactive",
516
+ "type": "boolean",
517
+ "title": "interactive"
518
+ },
519
+ "editable": {
520
+ "description": "Indicates if new category is editable",
521
+ "type": "boolean",
522
+ "title": "editable"
523
+ }
524
+ }
525
+ },
385
526
  "ConfigureMaxImageDimensionsProp": {
386
527
  "title": "ConfigureMaxImageDimensionsProp",
387
528
  "type": "object",
@@ -402,6 +543,96 @@
402
543
  "title": "rationale"
403
544
  }
404
545
  }
546
+ },
547
+ "ChartingOptions": {
548
+ "title": "ChartingOptions",
549
+ "type": "object",
550
+ "properties": {
551
+ "changeInteractive": {
552
+ "title": "ChartingOption",
553
+ "type": "object",
554
+ "properties": {
555
+ "settings": {
556
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
557
+ "type": "boolean",
558
+ "title": "settings"
559
+ },
560
+ "authoringLabel": {
561
+ "description": "Indicates the label for the option",
562
+ "type": "string",
563
+ "title": "authoringLabel"
564
+ },
565
+ "settingsLabel": {
566
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
567
+ "type": "string",
568
+ "title": "settingsLabel"
569
+ }
570
+ }
571
+ },
572
+ "changeEditable": {
573
+ "title": "ChartingOption",
574
+ "type": "object",
575
+ "properties": {
576
+ "settings": {
577
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
578
+ "type": "boolean",
579
+ "title": "settings"
580
+ },
581
+ "authoringLabel": {
582
+ "description": "Indicates the label for the option",
583
+ "type": "string",
584
+ "title": "authoringLabel"
585
+ },
586
+ "settingsLabel": {
587
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
588
+ "type": "string",
589
+ "title": "settingsLabel"
590
+ }
591
+ }
592
+ },
593
+ "addCategory": {
594
+ "title": "ChartingOption",
595
+ "type": "object",
596
+ "properties": {
597
+ "settings": {
598
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
599
+ "type": "boolean",
600
+ "title": "settings"
601
+ },
602
+ "authoringLabel": {
603
+ "description": "Indicates the label for the option",
604
+ "type": "string",
605
+ "title": "authoringLabel"
606
+ },
607
+ "settingsLabel": {
608
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
609
+ "type": "string",
610
+ "title": "settingsLabel"
611
+ }
612
+ }
613
+ }
614
+ }
615
+ },
616
+ "ChartingOption": {
617
+ "title": "ChartingOption",
618
+ "type": "object",
619
+ "properties": {
620
+ "settings": {
621
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
622
+ "type": "boolean",
623
+ "title": "settings"
624
+ },
625
+ "authoringLabel": {
626
+ "description": "Indicates the label for the option",
627
+ "type": "string",
628
+ "title": "authoringLabel"
629
+ },
630
+ "settingsLabel": {
631
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
632
+ "type": "string",
633
+ "title": "settingsLabel"
634
+ }
635
+ }
405
636
  }
406
637
  },
407
638
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -140,6 +140,38 @@ Indicates the label for the item that has to be displayed in the Settings Panel
140
140
  Indicates the value of the item if it affects config-ui
141
141
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
142
142
 
143
+ # `authorNewCategoryDefaults` (object, required)
144
+
145
+ Properties of the `authorNewCategoryDefaults` object:
146
+
147
+ ## `settings` (boolean)
148
+
149
+ Indicates if the item has to be displayed in the Settings Panel
150
+
151
+ ## `label` (string)
152
+
153
+ Indicates the label for the new category
154
+
155
+ ## `interactive` (boolean)
156
+
157
+ Indicates if new category is interactive
158
+
159
+ ## `editable` (boolean)
160
+
161
+ Indicates if new category is editable
162
+
163
+ # `studentNewCategoryDefaultLabel` (object, required)
164
+
165
+ Properties of the `studentNewCategoryDefaultLabel` object:
166
+
167
+ ## `settings` (boolean)
168
+
169
+ Indicates if the item has to be displayed in the Settings Panel
170
+
171
+ ## `label` (string)
172
+
173
+ Indicates the label for the item that has to be displayed in the Settings Panel
174
+
143
175
  # `maxImageWidth` (object)
144
176
 
145
177
  Properties of the `maxImageWidth` object:
@@ -184,6 +216,58 @@ Indicates if the item has to be displayed in the Settings Panel
184
216
 
185
217
  Indicates the label for the item that has to be displayed in the Settings Panel
186
218
 
219
+ # `chartingOptions` (object)
220
+
221
+ Properties of the `chartingOptions` object:
222
+
223
+ ## `changeInteractive` (object)
224
+
225
+ Properties of the `changeInteractive` object:
226
+
227
+ ### `settings` (boolean)
228
+
229
+ Indicates if the item has to be displayed in the Settings Panel
230
+
231
+ ### `authoringLabel` (string)
232
+
233
+ Indicates the label for the option
234
+
235
+ ### `settingsLabel` (string)
236
+
237
+ Indicates the label for the item that has to be displayed in the Settings Panel
238
+
239
+ ## `changeEditable` (object)
240
+
241
+ Properties of the `changeEditable` object:
242
+
243
+ ### `settings` (boolean)
244
+
245
+ Indicates if the item has to be displayed in the Settings Panel
246
+
247
+ ### `authoringLabel` (string)
248
+
249
+ Indicates the label for the option
250
+
251
+ ### `settingsLabel` (string)
252
+
253
+ Indicates the label for the item that has to be displayed in the Settings Panel
254
+
255
+ ## `addCategory` (object)
256
+
257
+ Properties of the `addCategory` object:
258
+
259
+ ### `settings` (boolean)
260
+
261
+ Indicates if the item has to be displayed in the Settings Panel
262
+
263
+ ### `authoringLabel` (string)
264
+
265
+ Indicates the label for the option
266
+
267
+ ### `settingsLabel` (string)
268
+
269
+ Indicates the label for the item that has to be displayed in the Settings Panel
270
+
187
271
  # `showPrompt` (boolean)
188
272
 
189
273
  Determines whether prompt field will be displayed or not
@@ -304,6 +388,26 @@ Indicates the label for the item that has to be displayed in the Settings Panel
304
388
  Indicates the value of the item if it affects config-ui
305
389
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
306
390
 
391
+ ## `AuthorNewCategoryDefaults` (object)
392
+
393
+ Properties of the `AuthorNewCategoryDefaults` object:
394
+
395
+ ### `settings` (boolean)
396
+
397
+ Indicates if the item has to be displayed in the Settings Panel
398
+
399
+ ### `label` (string)
400
+
401
+ Indicates the label for the new category
402
+
403
+ ### `interactive` (boolean)
404
+
405
+ Indicates if new category is interactive
406
+
407
+ ### `editable` (boolean)
408
+
409
+ Indicates if new category is editable
410
+
307
411
  ## `ConfigureMaxImageDimensionsProp` (object)
308
412
 
309
413
  Properties of the `ConfigureMaxImageDimensionsProp` object:
@@ -318,4 +422,72 @@ Indicates the max dimension for images in prompt - this is also the default dime
318
422
 
319
423
  ### `rationale` (number)
320
424
 
321
- Indicates the max dimension for images in rationale
425
+ Indicates the max dimension for images in rationale
426
+
427
+ ## `ChartingOptions` (object)
428
+
429
+ Properties of the `ChartingOptions` object:
430
+
431
+ ### `changeInteractive` (object)
432
+
433
+ Properties of the `changeInteractive` object:
434
+
435
+ #### `settings` (boolean)
436
+
437
+ Indicates if the item has to be displayed in the Settings Panel
438
+
439
+ #### `authoringLabel` (string)
440
+
441
+ Indicates the label for the option
442
+
443
+ #### `settingsLabel` (string)
444
+
445
+ Indicates the label for the item that has to be displayed in the Settings Panel
446
+
447
+ ### `changeEditable` (object)
448
+
449
+ Properties of the `changeEditable` object:
450
+
451
+ #### `settings` (boolean)
452
+
453
+ Indicates if the item has to be displayed in the Settings Panel
454
+
455
+ #### `authoringLabel` (string)
456
+
457
+ Indicates the label for the option
458
+
459
+ #### `settingsLabel` (string)
460
+
461
+ Indicates the label for the item that has to be displayed in the Settings Panel
462
+
463
+ ### `addCategory` (object)
464
+
465
+ Properties of the `addCategory` object:
466
+
467
+ #### `settings` (boolean)
468
+
469
+ Indicates if the item has to be displayed in the Settings Panel
470
+
471
+ #### `authoringLabel` (string)
472
+
473
+ Indicates the label for the option
474
+
475
+ #### `settingsLabel` (string)
476
+
477
+ Indicates the label for the item that has to be displayed in the Settings Panel
478
+
479
+ ## `ChartingOption` (object)
480
+
481
+ Properties of the `ChartingOption` object:
482
+
483
+ ### `settings` (boolean)
484
+
485
+ Indicates if the item has to be displayed in the Settings Panel
486
+
487
+ ### `authoringLabel` (string)
488
+
489
+ Indicates the label for the option
490
+
491
+ ### `settingsLabel` (string)
492
+
493
+ Indicates the label for the item that has to be displayed in the Settings Panel
@@ -2,7 +2,6 @@ exports.model = (id, element) => ({
2
2
  id,
3
3
  element,
4
4
  addCategoryEnabled: true,
5
- categoryDefaultLabel: 'Category',
6
5
  chartType: 'bar',
7
6
  correctAnswer: {
8
7
  data: [