@pie-element/number-line 13.1.1 → 13.1.2-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/author/arrows.d.ts +28 -0
- package/dist/author/arrows.js +69 -0
- package/dist/author/card-bar.d.ts +20 -0
- package/dist/author/card-bar.js +41 -0
- package/dist/author/defaults.d.ts +178 -0
- package/dist/author/defaults.js +144 -0
- package/dist/author/domain.d.ts +15 -0
- package/dist/author/domain.js +54 -0
- package/dist/author/index.d.ts +23 -0
- package/dist/author/index.js +89 -0
- package/dist/author/main.d.ts +44 -0
- package/dist/author/main.js +485 -0
- package/dist/author/number-text-field.d.ts +13 -0
- package/dist/author/number-text-field.js +13 -0
- package/dist/author/point-config.d.ts +25 -0
- package/dist/author/point-config.js +69 -0
- package/dist/author/size.d.ts +24 -0
- package/dist/author/size.js +48 -0
- package/dist/author/ticks.d.ts +22 -0
- package/dist/author/ticks.js +115 -0
- package/dist/author/utils.d.ts +9 -0
- package/dist/author/utils.js +4 -0
- package/dist/browser/author/index.js +40259 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +569 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2 -0
- package/dist/browser/delivery-Ci_kZyOM.js +17903 -0
- package/dist/browser/delivery-Ci_kZyOM.js.map +1 -0
- package/dist/browser/dist-D5T-OaLo.js +19038 -0
- package/dist/browser/dist-D5T-OaLo.js.map +1 -0
- package/dist/browser/impureFunctionsAny.generated-Bqfato71.js +10162 -0
- package/dist/browser/impureFunctionsAny.generated-Bqfato71.js.map +1 -0
- package/dist/browser/number-line.css +2 -0
- package/dist/controller/defaults.d.ts +58 -0
- package/dist/controller/defaults.js +50 -0
- package/dist/controller/index.d.ts +47 -0
- package/dist/controller/index.js +165 -0
- package/dist/controller/tickUtils.d.ts +21 -0
- package/dist/controller/tickUtils.js +252 -0
- package/dist/controller/utils.d.ts +9 -0
- package/dist/controller/utils.js +68 -0
- package/dist/delivery/data-converter.d.ts +64 -0
- package/dist/delivery/data-converter.js +70 -0
- package/dist/delivery/draggable/index.d.ts +33 -0
- package/dist/delivery/draggable/index.js +39 -0
- package/dist/delivery/index.d.ts +35 -0
- package/dist/delivery/index.js +109 -0
- package/dist/delivery/number-line/colors.d.ts +11 -0
- package/dist/delivery/number-line/colors.js +5 -0
- package/dist/delivery/number-line/feedback.d.ts +19 -0
- package/dist/delivery/number-line/feedback.js +57 -0
- package/dist/delivery/number-line/graph/arrow.d.ts +30 -0
- package/dist/delivery/number-line/graph/arrow.js +27 -0
- package/dist/delivery/number-line/graph/elements/base.d.ts +16 -0
- package/dist/delivery/number-line/graph/elements/base.js +11 -0
- package/dist/delivery/number-line/graph/elements/builder.d.ts +33 -0
- package/dist/delivery/number-line/graph/elements/builder.js +30 -0
- package/dist/delivery/number-line/graph/elements/line.d.ts +51 -0
- package/dist/delivery/number-line/graph/elements/line.js +188 -0
- package/dist/delivery/number-line/graph/elements/point.d.ts +43 -0
- package/dist/delivery/number-line/graph/elements/point.js +127 -0
- package/dist/delivery/number-line/graph/elements/ray.d.ts +43 -0
- package/dist/delivery/number-line/graph/elements/ray.js +130 -0
- package/dist/delivery/number-line/graph/index.d.ts +59 -0
- package/dist/delivery/number-line/graph/index.js +196 -0
- package/dist/delivery/number-line/graph/line.d.ts +46 -0
- package/dist/delivery/number-line/graph/line.js +27 -0
- package/dist/delivery/number-line/graph/stacks.d.ts +10 -0
- package/dist/delivery/number-line/graph/stacks.js +40 -0
- package/dist/delivery/number-line/graph/tick-utils.d.ts +80 -0
- package/dist/delivery/number-line/graph/tick-utils.js +295 -0
- package/dist/delivery/number-line/graph/ticks.d.ts +46 -0
- package/dist/delivery/number-line/graph/ticks.js +115 -0
- package/dist/delivery/number-line/index.d.ts +35 -0
- package/dist/delivery/number-line/index.js +215 -0
- package/dist/delivery/number-line/point-chooser/button.d.ts +31 -0
- package/dist/delivery/number-line/point-chooser/button.js +36 -0
- package/dist/delivery/number-line/point-chooser/img.d.ts +10 -0
- package/dist/delivery/number-line/point-chooser/img.js +4 -0
- package/dist/delivery/number-line/point-chooser/index.d.ts +37 -0
- package/dist/delivery/number-line/point-chooser/index.js +154 -0
- package/dist/delivery/number-line/point-chooser/styles.d.ts +192 -0
- package/dist/delivery/number-line/transitions/fade.d.ts +34 -0
- package/dist/delivery/number-line/transitions/fade.js +75 -0
- package/dist/delivery/number-line/transitions/index.d.ts +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +197 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +87 -21
- package/CHANGELOG.json +0 -1247
- package/CHANGELOG.md +0 -2435
- package/LICENSE.md +0 -5
- package/README.md +0 -28
- package/configure/CHANGELOG.json +0 -827
- package/configure/CHANGELOG.md +0 -2082
- package/configure/lib/arrows.js +0 -89
- package/configure/lib/arrows.js.map +0 -1
- package/configure/lib/card-bar.js +0 -57
- package/configure/lib/card-bar.js.map +0 -1
- package/configure/lib/defaults.js +0 -177
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/domain.js +0 -87
- package/configure/lib/domain.js.map +0 -1
- package/configure/lib/index.js +0 -176
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -815
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/number-text-field.js +0 -26
- package/configure/lib/number-text-field.js.map +0 -1
- package/configure/lib/point-config.js +0 -84
- package/configure/lib/point-config.js.map +0 -1
- package/configure/lib/size.js +0 -66
- package/configure/lib/size.js.map +0 -1
- package/configure/lib/ticks.js +0 -234
- package/configure/lib/ticks.js.map +0 -1
- package/configure/lib/utils.js +0 -12
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -20
- package/controller/CHANGELOG.json +0 -332
- package/controller/CHANGELOG.md +0 -1360
- package/controller/lib/defaults.js +0 -56
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -430
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/tickUtils.js +0 -294
- package/controller/lib/tickUtils.js.map +0 -1
- package/controller/lib/utils.js +0 -168
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -20
- package/demo.gif +0 -0
- package/docs/config-schema.json +0 -2532
- package/docs/config-schema.json.md +0 -1844
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -39
- package/docs/demo/index.html +0 -1
- package/docs/pie-schema.json +0 -2461
- package/docs/pie-schema.json.md +0 -1228
- package/docs/schemas/config.json +0 -256
- package/lib/data-converter.js +0 -96
- package/lib/data-converter.js.map +0 -1
- package/lib/draggable/index.js +0 -114
- package/lib/draggable/index.js.map +0 -1
- package/lib/index.js +0 -196
- package/lib/index.js.map +0 -1
- package/lib/number-line/colors.js +0 -11
- package/lib/number-line/colors.js.map +0 -1
- package/lib/number-line/feedback.js +0 -92
- package/lib/number-line/feedback.js.map +0 -1
- package/lib/number-line/graph/arrow.js +0 -44
- package/lib/number-line/graph/arrow.js.map +0 -1
- package/lib/number-line/graph/elements/base.js +0 -20
- package/lib/number-line/graph/elements/base.js.map +0 -1
- package/lib/number-line/graph/elements/builder.js +0 -37
- package/lib/number-line/graph/elements/builder.js.map +0 -1
- package/lib/number-line/graph/elements/line.js +0 -259
- package/lib/number-line/graph/elements/line.js.map +0 -1
- package/lib/number-line/graph/elements/point.js +0 -204
- package/lib/number-line/graph/elements/point.js.map +0 -1
- package/lib/number-line/graph/elements/ray.js +0 -190
- package/lib/number-line/graph/elements/ray.js.map +0 -1
- package/lib/number-line/graph/index.js +0 -262
- package/lib/number-line/graph/index.js.map +0 -1
- package/lib/number-line/graph/line.js +0 -38
- package/lib/number-line/graph/line.js.map +0 -1
- package/lib/number-line/graph/stacks.js +0 -78
- package/lib/number-line/graph/stacks.js.map +0 -1
- package/lib/number-line/graph/tick-utils.js +0 -347
- package/lib/number-line/graph/tick-utils.js.map +0 -1
- package/lib/number-line/graph/ticks.js +0 -188
- package/lib/number-line/graph/ticks.js.map +0 -1
- package/lib/number-line/index.js +0 -384
- package/lib/number-line/index.js.map +0 -1
- package/lib/number-line/point-chooser/button.js +0 -49
- package/lib/number-line/point-chooser/button.js.map +0 -1
- package/lib/number-line/point-chooser/img.js +0 -8
- package/lib/number-line/point-chooser/img.js.map +0 -1
- package/lib/number-line/point-chooser/index.js +0 -197
- package/lib/number-line/point-chooser/index.js.map +0 -1
- package/lib/number-line/point-chooser/styles.js +0 -77
- package/lib/number-line/point-chooser/styles.js.map +0 -1
- package/lib/number-line/transitions/fade.js +0 -88
- package/lib/number-line/transitions/fade.js.map +0 -1
- package/lib/number-line/transitions/index.js +0 -14
- package/lib/number-line/transitions/index.js.map +0 -1
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = {
|
|
8
|
-
correctResponse: [],
|
|
9
|
-
feedback: {
|
|
10
|
-
correct: {
|
|
11
|
-
default: 'Correct',
|
|
12
|
-
type: 'none'
|
|
13
|
-
},
|
|
14
|
-
incorrect: {
|
|
15
|
-
default: 'Incorrect',
|
|
16
|
-
type: 'none'
|
|
17
|
-
},
|
|
18
|
-
partial: {
|
|
19
|
-
default: 'Nearly',
|
|
20
|
-
type: 'none'
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
graph: {
|
|
24
|
-
arrows: {
|
|
25
|
-
left: true,
|
|
26
|
-
right: true
|
|
27
|
-
},
|
|
28
|
-
availableTypes: {
|
|
29
|
-
PF: true
|
|
30
|
-
},
|
|
31
|
-
domain: {
|
|
32
|
-
min: -1,
|
|
33
|
-
max: 1
|
|
34
|
-
},
|
|
35
|
-
exhibitOnly: false,
|
|
36
|
-
initialElements: [],
|
|
37
|
-
initialType: 'PF',
|
|
38
|
-
maxNumberOfPoints: 1,
|
|
39
|
-
ticks: {
|
|
40
|
-
minor: 0.125,
|
|
41
|
-
major: 0.5,
|
|
42
|
-
tickIntervalType: 'Decimal'
|
|
43
|
-
},
|
|
44
|
-
title: '',
|
|
45
|
-
width: 500
|
|
46
|
-
},
|
|
47
|
-
prompt: '',
|
|
48
|
-
promptEnabled: true,
|
|
49
|
-
rationale: '',
|
|
50
|
-
rationaleEnabled: true,
|
|
51
|
-
teacherInstructions: '',
|
|
52
|
-
teacherInstructionsEnabled: true,
|
|
53
|
-
toolbarEditorPosition: 'bottom',
|
|
54
|
-
widthEnabled: true
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["correctResponse","feedback","correct","default","type","incorrect","partial","graph","arrows","left","right","availableTypes","PF","domain","min","max","exhibitOnly","initialElements","initialType","maxNumberOfPoints","ticks","minor","major","tickIntervalType","title","width","prompt","promptEnabled","rationale","rationaleEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","widthEnabled"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n correctResponse: [],\n feedback: {\n correct: { default: 'Correct', type: 'none' },\n incorrect: { default: 'Incorrect', type: 'none' },\n partial: { default: 'Nearly', type: 'none' },\n },\n graph: {\n arrows: { left: true, right: true },\n availableTypes: {\n PF: true,\n },\n domain: { min: -1, max: 1 },\n exhibitOnly: false,\n initialElements: [],\n initialType: 'PF',\n maxNumberOfPoints: 1,\n ticks: { minor: 0.125, major: 0.5, tickIntervalType: 'Decimal' },\n title: '',\n width: 500,\n },\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n widthEnabled: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,eAAe,EAAE,EAAE;EACnBC,QAAQ,EAAE;IACRC,OAAO,EAAE;MAAEC,OAAO,EAAE,SAAS;MAAEC,IAAI,EAAE;IAAO,CAAC;IAC7CC,SAAS,EAAE;MAAEF,OAAO,EAAE,WAAW;MAAEC,IAAI,EAAE;IAAO,CAAC;IACjDE,OAAO,EAAE;MAAEH,OAAO,EAAE,QAAQ;MAAEC,IAAI,EAAE;IAAO;EAC7C,CAAC;EACDG,KAAK,EAAE;IACLC,MAAM,EAAE;MAAEC,IAAI,EAAE,IAAI;MAAEC,KAAK,EAAE;IAAK,CAAC;IACnCC,cAAc,EAAE;MACdC,EAAE,EAAE;IACN,CAAC;IACDC,MAAM,EAAE;MAAEC,GAAG,EAAE,CAAC,CAAC;MAAEC,GAAG,EAAE;IAAE,CAAC;IAC3BC,WAAW,EAAE,KAAK;IAClBC,eAAe,EAAE,EAAE;IACnBC,WAAW,EAAE,IAAI;IACjBC,iBAAiB,EAAE,CAAC;IACpBC,KAAK,EAAE;MAAEC,KAAK,EAAE,KAAK;MAAEC,KAAK,EAAE,GAAG;MAAEC,gBAAgB,EAAE;IAAU,CAAC;IAChEC,KAAK,EAAE,EAAE;IACTC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,IAAI;EACtBC,mBAAmB,EAAE,EAAE;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,qBAAqB,EAAE,QAAQ;EAC/BC,YAAY,EAAE;AAChB,CAAC","ignoreList":[]}
|
package/controller/lib/index.js
DELETED
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createCorrectResponseSession = exports.closeTo = exports.CLOSE_TO_PRECISION = void 0;
|
|
8
|
-
exports.createDefaultModel = createDefaultModel;
|
|
9
|
-
exports.getLogTrace = exports.getCorrectness = exports.getCorrected = void 0;
|
|
10
|
-
exports.getScore = getScore;
|
|
11
|
-
exports.model = model;
|
|
12
|
-
exports.normalize = normalize;
|
|
13
|
-
exports.outcome = outcome;
|
|
14
|
-
exports.validate = void 0;
|
|
15
|
-
var _lodashEs = require("lodash-es");
|
|
16
|
-
var _feedback = require("@pie-lib/feedback");
|
|
17
|
-
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
18
|
-
var math = _interopRequireWildcard(require("mathjs"));
|
|
19
|
-
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
20
|
-
var _utils = require("./utils");
|
|
21
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
|
-
const score = number => {
|
|
23
|
-
return {
|
|
24
|
-
score: {
|
|
25
|
-
scaled: number
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const getPartialScore = (corrected, ps) => {
|
|
30
|
-
const {
|
|
31
|
-
correct
|
|
32
|
-
} = corrected;
|
|
33
|
-
const rule = ps.find(r => r.numberOfCorrect === correct.length);
|
|
34
|
-
if (rule) {
|
|
35
|
-
return 1.0 * (rule.scorePercentage / 100);
|
|
36
|
-
} else {
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const accumulateAnswer = correctResponse => (total, answer) => {
|
|
41
|
-
const isCorrectResponse = correctResponse.some(cr => matches(cr)(answer));
|
|
42
|
-
return total + (isCorrectResponse ? 1 : 0);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Generates detailed trace log for scoring evaluation
|
|
47
|
-
* @param {Object} model - the question model
|
|
48
|
-
* @param {Object} session - the student session
|
|
49
|
-
* @param {Object} env - the environment
|
|
50
|
-
* @returns {Array} traceLog - array of trace messages
|
|
51
|
-
*/
|
|
52
|
-
const getLogTrace = (model, session, env) => {
|
|
53
|
-
const traceLog = [];
|
|
54
|
-
const studentAnswers = session?.answer || [];
|
|
55
|
-
const correctResponse = model?.correctResponse || [];
|
|
56
|
-
if (!studentAnswers.length) {
|
|
57
|
-
return ['Student did not interact with the number line.'];
|
|
58
|
-
}
|
|
59
|
-
const corrected = getCorrected(studentAnswers, (0, _lodashEs.cloneDeep)(correctResponse));
|
|
60
|
-
const {
|
|
61
|
-
correct,
|
|
62
|
-
incorrect,
|
|
63
|
-
notInAnswer,
|
|
64
|
-
noCorrectResponse
|
|
65
|
-
} = corrected;
|
|
66
|
-
if (noCorrectResponse) {
|
|
67
|
-
return ['No correct response is defined for this item.'];
|
|
68
|
-
}
|
|
69
|
-
const correctCount = correct.length;
|
|
70
|
-
const incorrectCount = incorrect.length;
|
|
71
|
-
const missingCount = notInAnswer.length;
|
|
72
|
-
if (correctCount > 0) {
|
|
73
|
-
traceLog.push(`${correctCount} object(s) correctly placed.`);
|
|
74
|
-
}
|
|
75
|
-
if (incorrectCount > 0) {
|
|
76
|
-
traceLog.push(`${incorrectCount} incorrect object(s) placed.`);
|
|
77
|
-
}
|
|
78
|
-
if (missingCount > 0) {
|
|
79
|
-
traceLog.push(`${missingCount} expected object(s) were not placed.`);
|
|
80
|
-
}
|
|
81
|
-
const studentAnswersCopy = [...studentAnswers];
|
|
82
|
-
const correctResponseCopy = [...correctResponse];
|
|
83
|
-
correct.forEach(index => {
|
|
84
|
-
const answer = studentAnswersCopy[index];
|
|
85
|
-
const objectType = answer?.type || 'object';
|
|
86
|
-
traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} is correct.`);
|
|
87
|
-
});
|
|
88
|
-
incorrect.forEach(index => {
|
|
89
|
-
const answer = studentAnswersCopy[index];
|
|
90
|
-
const objectType = answer?.type || 'object';
|
|
91
|
-
traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} does not match the expected response.`);
|
|
92
|
-
});
|
|
93
|
-
notInAnswer.forEach(expectedObject => {
|
|
94
|
-
const objectType = expectedObject?.type || 'object';
|
|
95
|
-
traceLog.push(`Expected ${objectType} at position ${expectedObject.domainPosition} was not placed by the student.`);
|
|
96
|
-
});
|
|
97
|
-
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
|
|
98
|
-
if (partialScoringEnabled) {
|
|
99
|
-
traceLog.push('Score calculated using partial scoring.');
|
|
100
|
-
traceLog.push(`Partial scoring is based on the number of correct objects, with deductions for extras.`);
|
|
101
|
-
} else {
|
|
102
|
-
traceLog.push('Score calculated using all-or-nothing scoring.');
|
|
103
|
-
}
|
|
104
|
-
const total = correctResponse.length || 1;
|
|
105
|
-
const extraPlacements = studentAnswers.length > total ? studentAnswers.length - total : 0;
|
|
106
|
-
if (extraPlacements > 0) {
|
|
107
|
-
traceLog.push(`${extraPlacements} extra object(s) beyond the required amount were placed and deducted.`);
|
|
108
|
-
}
|
|
109
|
-
const rawScore = Math.max(0, (correctCount - extraPlacements) / total);
|
|
110
|
-
const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;
|
|
111
|
-
traceLog.push(`Final score: ${finalScore}.`);
|
|
112
|
-
return traceLog;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
*/
|
|
117
|
-
exports.getLogTrace = getLogTrace;
|
|
118
|
-
function outcome(model, session, env) {
|
|
119
|
-
return new Promise(resolve => {
|
|
120
|
-
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
121
|
-
resolve({
|
|
122
|
-
score: 0,
|
|
123
|
-
empty: true,
|
|
124
|
-
logTrace: ['Student did not interact with the number line.']
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
|
|
128
|
-
const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);
|
|
129
|
-
let total = model.correctResponse.length;
|
|
130
|
-
let numIncorrect = 0;
|
|
131
|
-
if ((session.answer || []).length > total) {
|
|
132
|
-
numIncorrect = (session.answer || []).length - total;
|
|
133
|
-
}
|
|
134
|
-
if (total === 0) {
|
|
135
|
-
total = 1;
|
|
136
|
-
}
|
|
137
|
-
let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;
|
|
138
|
-
if (score < 0) {
|
|
139
|
-
score = 0;
|
|
140
|
-
}
|
|
141
|
-
resolve({
|
|
142
|
-
score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
|
|
143
|
-
logTrace: getLogTrace(model, session, env)
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function getScore(question, session) {
|
|
149
|
-
return new Promise(resolve => {
|
|
150
|
-
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
151
|
-
resolve({
|
|
152
|
-
score: {
|
|
153
|
-
scaled: 0
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
} else {
|
|
157
|
-
session.answer = session.answer || [];
|
|
158
|
-
const corrected = getCorrected(session.answer, (0, _lodashEs.cloneDeep)(question.correctResponse));
|
|
159
|
-
const correctness = getCorrectness(corrected);
|
|
160
|
-
if (correctness === 'correct') {
|
|
161
|
-
resolve(score(1.0));
|
|
162
|
-
} else if (correctness === 'incorrect') {
|
|
163
|
-
resolve(score(0.0));
|
|
164
|
-
} else if (correctness === 'partial') {
|
|
165
|
-
const {
|
|
166
|
-
allowPartialScoring,
|
|
167
|
-
partialScoring
|
|
168
|
-
} = question;
|
|
169
|
-
const ps = (partialScoring || []).filter(o => !(0, _lodashEs.isEmpty)(o));
|
|
170
|
-
const canDoPartialScoring = allowPartialScoring && ps.length > 0;
|
|
171
|
-
if (canDoPartialScoring) {
|
|
172
|
-
resolve(score(getPartialScore(corrected, ps)));
|
|
173
|
-
} else {
|
|
174
|
-
resolve(score(0.0));
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
resolve({
|
|
178
|
-
score: {
|
|
179
|
-
scaled: -1
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
const CLOSE_TO_PRECISION = exports.CLOSE_TO_PRECISION = 3;
|
|
187
|
-
const closeTo = (a, b, precision) => {
|
|
188
|
-
precision = precision || 5;
|
|
189
|
-
const expectedDiff = Math.pow(10, -precision) / 2;
|
|
190
|
-
const receivedDiff = Math.abs(a - b);
|
|
191
|
-
const close = receivedDiff <= expectedDiff;
|
|
192
|
-
return close;
|
|
193
|
-
};
|
|
194
|
-
exports.closeTo = closeTo;
|
|
195
|
-
const matches = a => v => {
|
|
196
|
-
return (0, _lodashEs.isEqualWith)(a, v, (v, ov) => {
|
|
197
|
-
if (typeof v === 'number' && typeof ov === 'number') {
|
|
198
|
-
return closeTo(v, ov, CLOSE_TO_PRECISION);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
const getCorrected = (answer, correctResponse) => {
|
|
203
|
-
if ((0, _lodashEs.isEmpty)(correctResponse) && answer.length > 0) {
|
|
204
|
-
return {
|
|
205
|
-
correct: [],
|
|
206
|
-
incorrect: [],
|
|
207
|
-
notInAnswer: [],
|
|
208
|
-
noCorrectResponse: true
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
return answer.reduce((acc, a, index) => {
|
|
212
|
-
const {
|
|
213
|
-
correct,
|
|
214
|
-
incorrect,
|
|
215
|
-
notInAnswer
|
|
216
|
-
} = acc;
|
|
217
|
-
const match = (0, _lodashEs.find)(notInAnswer, matches(a));
|
|
218
|
-
if (match) {
|
|
219
|
-
correct.push(index);
|
|
220
|
-
notInAnswer.splice(notInAnswer.indexOf(match), 1);
|
|
221
|
-
} else {
|
|
222
|
-
incorrect.push(index);
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
correct: correct,
|
|
226
|
-
incorrect: incorrect,
|
|
227
|
-
notInAnswer: notInAnswer
|
|
228
|
-
};
|
|
229
|
-
}, {
|
|
230
|
-
correct: [],
|
|
231
|
-
incorrect: [],
|
|
232
|
-
notInAnswer: correctResponse
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
exports.getCorrected = getCorrected;
|
|
236
|
-
const getCorrectness = corrected => {
|
|
237
|
-
const {
|
|
238
|
-
incorrect,
|
|
239
|
-
correct,
|
|
240
|
-
notInAnswer,
|
|
241
|
-
noCorrectResponse
|
|
242
|
-
} = corrected;
|
|
243
|
-
if (noCorrectResponse) {
|
|
244
|
-
return 'unknown';
|
|
245
|
-
}
|
|
246
|
-
if (incorrect.length === 0 && correct.length === 0) {
|
|
247
|
-
return 'unanswered';
|
|
248
|
-
}
|
|
249
|
-
if (incorrect.length === 0 && notInAnswer.length === 0) {
|
|
250
|
-
return 'correct';
|
|
251
|
-
}
|
|
252
|
-
if (incorrect.length > 0 || notInAnswer.length > 0) {
|
|
253
|
-
if (correct.length > 0) {
|
|
254
|
-
return 'partial';
|
|
255
|
-
} else {
|
|
256
|
-
return 'incorrect';
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return 'unknown';
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* A sample of a normalize function see:
|
|
264
|
-
* https://github.com/pie-framework/pie-elements/issues/21
|
|
265
|
-
*/
|
|
266
|
-
exports.getCorrectness = getCorrectness;
|
|
267
|
-
function normalize(question) {
|
|
268
|
-
const feedback = (0, _lodashEs.merge)(_defaults.default.feedback, question.feedback);
|
|
269
|
-
return {
|
|
270
|
-
..._defaults.default,
|
|
271
|
-
...question,
|
|
272
|
-
feedback
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
function createDefaultModel(model = {}) {
|
|
276
|
-
return new Promise(resolve => {
|
|
277
|
-
const out = {
|
|
278
|
-
...model,
|
|
279
|
-
graph: {
|
|
280
|
-
..._defaults.default.graph,
|
|
281
|
-
...model.graph
|
|
282
|
-
},
|
|
283
|
-
colorContrast: 'black_on_white'
|
|
284
|
-
};
|
|
285
|
-
resolve((0, _lodashEs.omitBy)(out, v => !v));
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// this function is duplicated in configure; at some point, use the same shared function
|
|
290
|
-
const updateTicks = model => {
|
|
291
|
-
const {
|
|
292
|
-
graph: {
|
|
293
|
-
domain,
|
|
294
|
-
labelStep,
|
|
295
|
-
ticks = {}
|
|
296
|
-
} = {}
|
|
297
|
-
} = model;
|
|
298
|
-
const {
|
|
299
|
-
minor,
|
|
300
|
-
major
|
|
301
|
-
} = ticks;
|
|
302
|
-
if (domain) {
|
|
303
|
-
domain.min = Number((domain.min || 0).toFixed(2));
|
|
304
|
-
domain.max = Number((domain.max || 0).toFixed(2));
|
|
305
|
-
}
|
|
306
|
-
if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\/[1-9][0-9]*$/g)) {
|
|
307
|
-
model.graph.fraction = true;
|
|
308
|
-
ticks.tickIntervalType = 'Fraction';
|
|
309
|
-
|
|
310
|
-
// update the ticks frequency and label value to match the label step if needed
|
|
311
|
-
const step = math.evaluate(labelStep);
|
|
312
|
-
if (step !== major) {
|
|
313
|
-
ticks.major = step;
|
|
314
|
-
ticks.minor = step / (major / minor);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return model;
|
|
318
|
-
};
|
|
319
|
-
async function model(question, session, env) {
|
|
320
|
-
if (!question) {
|
|
321
|
-
throw new Error('question is null');
|
|
322
|
-
}
|
|
323
|
-
const normalizedQuestion = await normalize(question);
|
|
324
|
-
const normalizedModel = updateTicks(normalizedQuestion);
|
|
325
|
-
// this function is also called in configure, it is a duplicate to maintain consistency and correctness
|
|
326
|
-
const graph = (0, _utils.reloadTicksData)(normalizedModel.graph);
|
|
327
|
-
if (graph) {
|
|
328
|
-
const evaluateMode = env.mode === 'evaluate';
|
|
329
|
-
const correctResponse = (0, _lodashEs.cloneDeep)(normalizedQuestion.correctResponse);
|
|
330
|
-
const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);
|
|
331
|
-
const correctness = evaluateMode && getCorrectness(corrected);
|
|
332
|
-
const {
|
|
333
|
-
exhibitOnly
|
|
334
|
-
} = graph;
|
|
335
|
-
const disabled = env.mode !== 'gather' || exhibitOnly === true;
|
|
336
|
-
let teacherInstructions = null;
|
|
337
|
-
if (env.role === 'instructor' && (env.mode === 'view' || evaluateMode)) {
|
|
338
|
-
teacherInstructions = normalizedQuestion.teacherInstructions;
|
|
339
|
-
}
|
|
340
|
-
const feedbackMessage = evaluateMode ? await (0, _feedback.getFeedbackForCorrectness)(correctness, normalizedQuestion.feedback) : undefined;
|
|
341
|
-
const out = {
|
|
342
|
-
prompt: normalizedQuestion.prompt,
|
|
343
|
-
teacherInstructions,
|
|
344
|
-
graph,
|
|
345
|
-
disabled,
|
|
346
|
-
corrected,
|
|
347
|
-
correctResponse: evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,
|
|
348
|
-
feedback: feedbackMessage && {
|
|
349
|
-
type: correctness,
|
|
350
|
-
message: feedbackMessage
|
|
351
|
-
},
|
|
352
|
-
colorContrast: env.accessibility && env.accessibility.colorContrast || 'black_on_white',
|
|
353
|
-
language: normalizedQuestion.language,
|
|
354
|
-
extraCSSRules: normalizedQuestion.extraCSSRules
|
|
355
|
-
};
|
|
356
|
-
return (0, _lodashEs.omitBy)(out, v => !v);
|
|
357
|
-
} else {
|
|
358
|
-
throw new Error('graph is undefined');
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
const createCorrectResponseSession = (question, env) => {
|
|
362
|
-
return new Promise(resolve => {
|
|
363
|
-
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
364
|
-
const {
|
|
365
|
-
correctResponse: answer
|
|
366
|
-
} = question;
|
|
367
|
-
resolve({
|
|
368
|
-
answer,
|
|
369
|
-
id: '1'
|
|
370
|
-
});
|
|
371
|
-
} else {
|
|
372
|
-
resolve(null);
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
// remove all html tags
|
|
378
|
-
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
379
|
-
const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
|
|
380
|
-
|
|
381
|
-
// remove all html tags except img, iframe and source tag for audio
|
|
382
|
-
const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
383
|
-
const validate = (model = {}, config = {}) => {
|
|
384
|
-
const {
|
|
385
|
-
graph,
|
|
386
|
-
correctResponse
|
|
387
|
-
} = model || {};
|
|
388
|
-
const {
|
|
389
|
-
maxMaxElements = 20,
|
|
390
|
-
numberLineDimensions: {
|
|
391
|
-
min: minWidth = 200,
|
|
392
|
-
max: maxWidth = 800
|
|
393
|
-
} = {}
|
|
394
|
-
} = config || {};
|
|
395
|
-
const {
|
|
396
|
-
width,
|
|
397
|
-
domain,
|
|
398
|
-
maxNumberOfPoints
|
|
399
|
-
} = graph || {};
|
|
400
|
-
const {
|
|
401
|
-
min,
|
|
402
|
-
max
|
|
403
|
-
} = domain || {};
|
|
404
|
-
const errors = {};
|
|
405
|
-
['teacherInstructions', 'prompt'].forEach(field => {
|
|
406
|
-
if (config[field]?.required && !getContent(model[field])) {
|
|
407
|
-
errors[field] = 'This field is required.';
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
if (width < minWidth || width > maxWidth) {
|
|
411
|
-
errors.widthError = `Width should be a value between ${minWidth} and ${maxWidth}.`;
|
|
412
|
-
}
|
|
413
|
-
const MIN_DOMAIN = -100000;
|
|
414
|
-
const MAX_DOMAIN = 100000;
|
|
415
|
-
if (min < MIN_DOMAIN || min > MAX_DOMAIN || max < MIN_DOMAIN || max > MAX_DOMAIN) {
|
|
416
|
-
errors.domainError = `Min and max values must both be in the range [${MIN_DOMAIN}, ${MAX_DOMAIN}].`;
|
|
417
|
-
}
|
|
418
|
-
if (min >= max) {
|
|
419
|
-
errors.maxError = 'Max value must be greater than min value.';
|
|
420
|
-
}
|
|
421
|
-
if (maxNumberOfPoints < 1 || maxNumberOfPoints > maxMaxElements) {
|
|
422
|
-
errors.pointsError = `Max number of elements should be between 1 and ${maxMaxElements}.`;
|
|
423
|
-
}
|
|
424
|
-
if (correctResponse && correctResponse.length === 0) {
|
|
425
|
-
errors.correctResponseError = 'The correct answer should include at least one number line object.';
|
|
426
|
-
}
|
|
427
|
-
return errors;
|
|
428
|
-
};
|
|
429
|
-
exports.validate = validate;
|
|
430
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_lodashEs","require","_feedback","_controllerUtils","math","_interopRequireWildcard","_defaults","_interopRequireDefault","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","score","number","scaled","getPartialScore","corrected","ps","correct","rule","find","numberOfCorrect","length","scorePercentage","accumulateAnswer","correctResponse","total","answer","isCorrectResponse","some","cr","matches","getLogTrace","model","session","env","traceLog","studentAnswers","getCorrected","cloneDeep","incorrect","notInAnswer","noCorrectResponse","correctCount","incorrectCount","missingCount","push","studentAnswersCopy","correctResponseCopy","forEach","index","objectType","type","charAt","toUpperCase","slice","domainPosition","expectedObject","partialScoringEnabled","partialScoring","enabled","extraPlacements","rawScore","Math","max","finalScore","exports","outcome","Promise","resolve","isEmpty","empty","logTrace","numCorrect","reduce","numIncorrect","getScore","question","correctness","getCorrectness","allowPartialScoring","filter","canDoPartialScoring","CLOSE_TO_PRECISION","closeTo","a","b","precision","expectedDiff","pow","receivedDiff","abs","close","v","isEqualWith","ov","acc","match","splice","indexOf","normalize","feedback","merge","defaults","createDefaultModel","out","graph","colorContrast","omitBy","updateTicks","domain","labelStep","ticks","minor","major","min","Number","toFixed","fraction","tickIntervalType","step","evaluate","Error","normalizedQuestion","normalizedModel","reloadTicksData","evaluateMode","mode","exhibitOnly","disabled","teacherInstructions","role","feedbackMessage","getFeedbackForCorrectness","undefined","prompt","message","accessibility","language","extraCSSRules","createCorrectResponseSession","id","getInnerText","html","replaceAll","getContent","replace","validate","config","maxMaxElements","numberLineDimensions","minWidth","maxWidth","width","maxNumberOfPoints","errors","field","required","widthError","MIN_DOMAIN","MAX_DOMAIN","domainError","maxError","pointsError","correctResponseError"],"sources":["../src/index.js"],"sourcesContent":["import { cloneDeep, find, isEmpty, isEqualWith, merge, omitBy } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport * as math from 'mathjs';\n\nimport defaults from './defaults';\nimport { reloadTicksData } from './utils';\n\nconst score = (number) => {\n return {\n score: {\n scaled: number,\n },\n };\n};\n\nconst getPartialScore = (corrected, ps) => {\n const { correct } = corrected;\n const rule = ps.find((r) => r.numberOfCorrect === correct.length);\n\n if (rule) {\n return 1.0 * (rule.scorePercentage / 100);\n } else {\n return 0;\n }\n};\n\nconst accumulateAnswer = (correctResponse) => (total, answer) => {\n const isCorrectResponse = correctResponse.some((cr) => matches(cr)(answer));\n return total + (isCorrectResponse ? 1 : 0);\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\n const studentAnswers = session?.answer || [];\n const correctResponse = model?.correctResponse || [];\n\n if (!studentAnswers.length) {\n return ['Student did not interact with the number line.'];\n }\n\n const corrected = getCorrected(studentAnswers, cloneDeep(correctResponse));\n const { correct, incorrect, notInAnswer, noCorrectResponse } = corrected;\n\n if (noCorrectResponse) {\n return ['No correct response is defined for this item.'];\n }\n\n const correctCount = correct.length;\n const incorrectCount = incorrect.length;\n const missingCount = notInAnswer.length;\n\n if (correctCount > 0) {\n traceLog.push(`${correctCount} object(s) correctly placed.`);\n }\n\n if (incorrectCount > 0) {\n traceLog.push(`${incorrectCount} incorrect object(s) placed.`);\n }\n\n if (missingCount > 0) {\n traceLog.push(`${missingCount} expected object(s) were not placed.`);\n }\n\n const studentAnswersCopy = [...studentAnswers];\n const correctResponseCopy = [...correctResponse];\n\n correct.forEach((index) => {\n const answer = studentAnswersCopy[index];\n const objectType = answer?.type || 'object';\n traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} is correct.`);\n });\n\n incorrect.forEach((index) => {\n const answer = studentAnswersCopy[index];\n const objectType = answer?.type || 'object';\n traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} does not match the expected response.`);\n });\n\n notInAnswer.forEach((expectedObject) => {\n const objectType = expectedObject?.type || 'object';\n traceLog.push(`Expected ${objectType} at position ${expectedObject.domainPosition} was not placed by the student.`);\n });\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push(`Partial scoring is based on the number of correct objects, with deductions for extras.`);\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n }\n\n const total = correctResponse.length || 1;\n const extraPlacements =\n studentAnswers.length > total ? studentAnswers.length - total : 0;\n\n if (extraPlacements > 0) {\n traceLog.push(\n `${extraPlacements} extra object(s) beyond the required amount were placed and deducted.`,\n );\n }\n\n const rawScore = Math.max(0, (correctCount - extraPlacements) / total);\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\n\n/**\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not interact with the number line.'] });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);\n\n let total = model.correctResponse.length;\n let numIncorrect = 0;\n\n if ((session.answer || []).length > total) {\n numIncorrect = (session.answer || []).length - total;\n }\n\n if (total === 0) {\n total = 1;\n }\n\n let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;\n\n if (score < 0) {\n score = 0;\n }\n\n resolve({ \n score: partialScoringEnabled ? score : score === 1 ? 1 : 0,\n logTrace: getLogTrace(model, session, env)\n });\n }\n });\n}\n\nexport function getScore(question, session) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: { scaled: 0 } });\n } else {\n session.answer = session.answer || [];\n\n const corrected = getCorrected(session.answer, cloneDeep(question.correctResponse));\n\n const correctness = getCorrectness(corrected);\n\n if (correctness === 'correct') {\n resolve(score(1.0));\n } else if (correctness === 'incorrect') {\n resolve(score(0.0));\n } else if (correctness === 'partial') {\n const { allowPartialScoring, partialScoring } = question;\n const ps = (partialScoring || []).filter((o) => !isEmpty(o));\n const canDoPartialScoring = allowPartialScoring && ps.length > 0;\n if (canDoPartialScoring) {\n resolve(score(getPartialScore(corrected, ps)));\n } else {\n resolve(score(0.0));\n }\n } else {\n resolve({ score: { scaled: -1 } });\n }\n }\n });\n}\n\nexport const CLOSE_TO_PRECISION = 3;\n\nexport const closeTo = (a, b, precision) => {\n precision = precision || 5;\n const expectedDiff = Math.pow(10, -precision) / 2;\n const receivedDiff = Math.abs(a - b);\n const close = receivedDiff <= expectedDiff;\n return close;\n};\n\nconst matches = (a) => (v) => {\n return isEqualWith(a, v, (v, ov) => {\n if (typeof v === 'number' && typeof ov === 'number') {\n return closeTo(v, ov, CLOSE_TO_PRECISION);\n }\n });\n};\n\nexport const getCorrected = (answer, correctResponse) => {\n if (isEmpty(correctResponse) && answer.length > 0) {\n return {\n correct: [],\n incorrect: [],\n notInAnswer: [],\n noCorrectResponse: true,\n };\n }\n\n return answer.reduce(\n (acc, a, index) => {\n const { correct, incorrect, notInAnswer } = acc;\n\n const match = find(notInAnswer, matches(a));\n if (match) {\n correct.push(index);\n notInAnswer.splice(notInAnswer.indexOf(match), 1);\n } else {\n incorrect.push(index);\n }\n\n return {\n correct: correct,\n incorrect: incorrect,\n notInAnswer: notInAnswer,\n };\n },\n {\n correct: [],\n incorrect: [],\n notInAnswer: correctResponse,\n },\n );\n};\n\nexport const getCorrectness = (corrected) => {\n const { incorrect, correct, notInAnswer, noCorrectResponse } = corrected;\n\n if (noCorrectResponse) {\n return 'unknown';\n }\n\n if (incorrect.length === 0 && correct.length === 0) {\n return 'unanswered';\n }\n\n if (incorrect.length === 0 && notInAnswer.length === 0) {\n return 'correct';\n }\n\n if (incorrect.length > 0 || notInAnswer.length > 0) {\n if (correct.length > 0) {\n return 'partial';\n } else {\n return 'incorrect';\n }\n }\n\n return 'unknown';\n};\n\n/**\n * A sample of a normalize function see:\n * https://github.com/pie-framework/pie-elements/issues/21\n */\nexport function normalize(question) {\n const feedback = merge(defaults.feedback, question.feedback);\n\n return { ...defaults, ...question, feedback };\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n const out = {\n ...model,\n graph: {\n ...defaults.graph,\n ...model.graph,\n },\n colorContrast: 'black_on_white',\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n}\n\n// this function is duplicated in configure; at some point, use the same shared function\nconst updateTicks = (model) => {\n const { graph: { domain, labelStep, ticks = {} } = {} } = model;\n const { minor, major } = ticks;\n\n if (domain) {\n domain.min = Number((domain.min || 0).toFixed(2));\n domain.max = Number((domain.max || 0).toFixed(2));\n }\n\n if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\\/[1-9][0-9]*$/g)) {\n model.graph.fraction = true;\n ticks.tickIntervalType = 'Fraction';\n\n // update the ticks frequency and label value to match the label step if needed\n const step = math.evaluate(labelStep);\n\n if (step !== major) {\n ticks.major = step;\n ticks.minor = step / (major / minor);\n }\n }\n\n return model;\n};\n\nexport async function model(question, session, env) {\n if (!question) {\n throw new Error('question is null');\n }\n\n const normalizedQuestion = await normalize(question);\n const normalizedModel = updateTicks(normalizedQuestion);\n // this function is also called in configure, it is a duplicate to maintain consistency and correctness\n const graph = reloadTicksData(normalizedModel.graph);\n\n if (graph) {\n const evaluateMode = env.mode === 'evaluate';\n\n const correctResponse = cloneDeep(normalizedQuestion.correctResponse);\n const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);\n const correctness = evaluateMode && getCorrectness(corrected);\n\n const { exhibitOnly } = graph;\n const disabled = env.mode !== 'gather' || exhibitOnly === true;\n let teacherInstructions = null;\n\n if (env.role === 'instructor' && (env.mode === 'view' || evaluateMode)) {\n teacherInstructions = normalizedQuestion.teacherInstructions;\n }\n\n const feedbackMessage = evaluateMode\n ? await getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : undefined;\n\n const out = {\n prompt: normalizedQuestion.prompt,\n teacherInstructions,\n graph,\n disabled,\n corrected,\n correctResponse:\n evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,\n feedback: feedbackMessage && {\n type: correctness,\n message: feedbackMessage,\n },\n colorContrast: (env.accessibility && env.accessibility.colorContrast) || 'black_on_white',\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n return omitBy(out, (v) => !v);\n } else {\n throw new Error('graph is undefined');\n }\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse: answer } = question;\n\n resolve({\n answer,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { graph, correctResponse } = model || {};\n const { maxMaxElements = 20, numberLineDimensions: { min: minWidth = 200, max: maxWidth = 800 } = {} } = config || {};\n const { width, domain, maxNumberOfPoints } = graph || {};\n const { min, max } = domain || {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n if (width < minWidth || width > maxWidth) {\n errors.widthError = `Width should be a value between ${minWidth} and ${maxWidth}.`;\n }\n\n const MIN_DOMAIN = -100000;\n const MAX_DOMAIN = 100000;\n\n if (min < MIN_DOMAIN || min > MAX_DOMAIN || max < MIN_DOMAIN || max > MAX_DOMAIN) {\n errors.domainError = `Min and max values must both be in the range [${MIN_DOMAIN}, ${MAX_DOMAIN}].`;\n }\n\n if (min >= max) {\n errors.maxError = 'Max value must be greater than min value.';\n }\n\n if (maxNumberOfPoints < 1 || maxNumberOfPoints > maxMaxElements) {\n errors.pointsError = `Max number of elements should be between 1 and ${maxMaxElements}.`;\n }\n\n if (correctResponse && correctResponse.length === 0) {\n errors.correctResponseError = 'The correct answer should include at least one number line object.';\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA0C,SAAAI,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,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