@pie-element/number-line 13.2.2-beta.5 → 13.2.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/configure/CHANGELOG.md +4 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +4 -0
- package/controller/package.json +1 -1
- package/package.json +2 -2
- 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 -180
- 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/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/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 -197
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ticks.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_configUi","_FormControlLabel","_RadioGroup","_Radio","math","_interopRequireWildcard","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DisplayFlex","styled","display","FlexCol1","flexFlow","gap","width","FlexCol2","RadioInputs","alignItems","paddingTop","paddingBottom","TableFixed","tableLayout","LabelWidth","CustomColorRadio","Radio","color","tertiary","StyledNumberTextFieldCustom","NumberTextFieldCustom","maxWidth","cursor","TickIntervals","exports","Ticks","props","ticks","onChange","minorLimits","minorValues","majorValues","fractionMajor","fraction","number","major","fractionMajorString","d","toString","changeTickIntervalType","tickIntervalType","includes","minor","integerTick","decimalTick","fractionTick","changeIntegerTick","changeFractionTick","changeDecimalTick","changeFractionLabel","fractionLabel","changeDecimalLabel","decimalLabel","createElement","name","value","control","checked","label","disabled","max","min","ceil","floor","step","onlyIntegersAllowed","variant","type","key","length","customValues","decimal","propTypes","PropTypes","func","object","_default"],"sources":["../src/ticks.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { NumberTextFieldCustom } from '@pie-lib/config-ui';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport Radio from '@mui/material/Radio';\nimport * as math from 'mathjs';\nimport { color } from '@pie-lib/render-ui';\n\nconst DisplayFlex = styled('div')({\n display: 'flex',\n});\n\nconst FlexCol1 = styled('div')({\n display: 'flex',\n flexFlow: 'column',\n gap: '10px',\n width: '65%',\n});\n\nconst FlexCol2 = styled('div')({\n display: 'flex',\n flexFlow: 'column',\n gap: '10px',\n});\n\nconst RadioInputs = styled('tr')({\n display: 'flex',\n alignItems: 'center',\n paddingTop: '5px',\n paddingBottom: '5px',\n});\n\nconst TableFixed = styled('table')({\n tableLayout: 'fixed',\n width: '100%',\n});\n\nconst LabelWidth = styled('td')({\n width: '35%',\n});\n\nconst CustomColorRadio = styled(Radio)({\n color: `${color.tertiary()} !important`,\n});\n\nconst StyledNumberTextFieldCustom = styled(NumberTextFieldCustom)({\n '& input': {\n maxWidth: '145px',\n cursor: 'default',\n },\n});\n\n// This const will store available tick interval types.\nexport const TickIntervals = ['Integer', 'Fraction', 'Decimal'];\n\nexport const Ticks = (props) => {\n const { ticks, onChange, minorLimits, minorValues, majorValues } = props;\n\n //Format decimal value of label interval to fraction\n const fractionMajor = math.fraction(math.number(ticks.major));\n const fractionMajorString =\n fractionMajor.d === 1 ? fractionMajor.n.toString() : fractionMajor.n + '/' + fractionMajor.d;\n\n /*\n * Function to handle tick interval type radio group change\n * @param e change event object\n * @param tickIntervalType string value for changed tick interval type\n * */\n const changeTickIntervalType = (e, tickIntervalType) => {\n if (!TickIntervals.includes(tickIntervalType)) {\n return;\n }\n if (tickIntervalType === 'Integer') {\n ticks.minor = ticks.integerTick;\n } else if (tickIntervalType === 'Decimal') {\n ticks.minor = ticks.decimalTick;\n } else if (tickIntervalType === 'Fraction') {\n ticks.minor = math.number(math.fraction(ticks.fractionTick));\n }\n ticks.tickIntervalType = tickIntervalType;\n onChange({ ticks });\n };\n\n /*\n * Function to handle change in integer tick interval\n * @param e change event object\n * @param integerTick number value for changed tick\n * */\n const changeIntegerTick = (e, integerTick) => {\n if (ticks.tickIntervalType === 'Integer') {\n ticks.integerTick = integerTick;\n ticks.minor = integerTick;\n onChange({ ticks });\n }\n };\n\n /*\n * Function to handle change in fraction tick interval\n * @param e change event object\n * @param fractionTick string value for changed tick\n * */\n const changeFractionTick = (e, fractionTick) => {\n if (ticks.tickIntervalType === 'Fraction') {\n ticks.fractionTick = fractionTick;\n ticks.minor = math.number(math.fraction(fractionTick));\n onChange({ ticks });\n }\n };\n\n /*\n * Function to handle change in decimal tick interval\n * @param e change event object\n * @param decimalTick number value for changed tick\n * */\n const changeDecimalTick = (e, decimalTick) => {\n if (ticks.tickIntervalType === 'Decimal') {\n ticks.decimalTick = decimalTick;\n ticks.minor = decimalTick;\n onChange({ ticks });\n }\n };\n\n /*\n * Function to handle change in fraction label interval value\n * @param e change event object\n * @param fractionLabel string value for changed label interval\n * */\n const changeFractionLabel = (e, fractionLabel) => {\n if (ticks.tickIntervalType === 'Fraction') {\n ticks.major = math.number(math.fraction(fractionLabel));\n onChange({ ticks });\n }\n };\n\n /*\n * Function to handle change in decimal label interval value\n * @param e change event object\n * @param decimalLabel number value for changed label interval\n * */\n const changeDecimalLabel = (e, decimalLabel) => {\n if (ticks.tickIntervalType === 'Decimal' || ticks.tickIntervalType === 'Integer') {\n ticks.major = decimalLabel;\n onChange({ ticks });\n }\n };\n\n return (\n <DisplayFlex>\n <FlexCol1>\n <label>Tick Interval</label>\n <RadioGroup\n aria-label=\"tick-interval-type\"\n name=\"tickIntervalType\"\n value={ticks.tickIntervalType}\n onChange={changeTickIntervalType}\n >\n <TableFixed>\n <tbody>\n <RadioInputs>\n <LabelWidth>\n <FormControlLabel\n value=\"Integer\"\n control={<CustomColorRadio checked={ticks.tickIntervalType === 'Integer'} />}\n label=\"Integer\"\n disabled={minorLimits.max < 1}\n />\n </LabelWidth>\n <td>\n <StyledNumberTextFieldCustom\n value={ticks.integerTick}\n min={math.number(math.ceil(minorLimits.min))}\n max={math.number(math.floor(minorLimits.max))}\n step={1}\n onlyIntegersAllowed={true}\n onChange={changeIntegerTick}\n variant={'outlined'}\n type={'number'}\n disabled={ticks.tickIntervalType !== 'Integer' || minorLimits.max < 1}\n key={\n ticks.tickIntervalType !== 'Integer' || minorLimits.max < 1 ? 'integerDisabled' : 'integerEnabled'\n }\n />\n </td>\n </RadioInputs>\n <RadioInputs>\n <LabelWidth>\n <FormControlLabel\n value=\"Fraction\"\n control={<CustomColorRadio checked={ticks.tickIntervalType === 'Fraction'} />}\n label=\"Unit Fraction\"\n disabled={minorValues.fraction.length === 0}\n />\n </LabelWidth>\n <td>\n <StyledNumberTextFieldCustom\n value={ticks.fractionTick}\n customValues={minorValues.fraction}\n onChange={changeFractionTick}\n variant={'outlined'}\n type={'text'}\n disabled={ticks.tickIntervalType !== 'Fraction' || minorValues.fraction.length === 0}\n key={\n ticks.tickIntervalType !== 'Fraction' || minorValues.fraction.length === 0\n ? 'fractionDisabled'\n : 'fractionEnabled'\n }\n />\n </td>\n </RadioInputs>\n <RadioInputs>\n <LabelWidth>\n <FormControlLabel\n value=\"Decimal\"\n control={<CustomColorRadio checked={ticks.tickIntervalType === 'Decimal'} />}\n label=\"Decimal\"\n disabled={minorValues.decimal.length === 0}\n />\n </LabelWidth>\n <td>\n <StyledNumberTextFieldCustom\n value={ticks.decimalTick}\n customValues={minorValues.decimal}\n onChange={changeDecimalTick}\n variant={'outlined'}\n type={'number'}\n disabled={ticks.tickIntervalType !== 'Decimal' || minorValues.decimal.length === 0}\n key={\n ticks.tickIntervalType !== 'Decimal' || minorValues.decimal.length === 0\n ? 'decimalDisabled'\n : 'decimalEnabled'\n }\n />\n </td>\n </RadioInputs>\n </tbody>\n </TableFixed>\n </RadioGroup>\n </FlexCol1>\n <FlexCol2>\n <label>Label Interval</label>\n <StyledNumberTextFieldCustom\n value={ticks.tickIntervalType === 'Fraction' ? fractionMajorString : ticks.major}\n variant={'outlined'}\n customValues={ticks.tickIntervalType === 'Fraction' ? majorValues.fraction : majorValues.decimal}\n type={ticks.tickIntervalType === 'Fraction' ? 'text' : 'number'}\n onChange={ticks.tickIntervalType === 'Fraction' ? changeFractionLabel : changeDecimalLabel}\n />\n </FlexCol2>\n </DisplayFlex>\n );\n};\nTicks.propTypes = {\n onChange: PropTypes.func,\n ticks: PropTypes.object,\n minorLimits: PropTypes.object,\n minorValues: PropTypes.object,\n majorValues: PropTypes.object,\n};\n\nexport default Ticks;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA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qBACPtC,MAAA,CAAAsB,OAAA,CAAA8D,aAAA,gBAAO,gBAAqB,CAAC,eAC7BpF,MAAA,CAAAsB,OAAA,CAAA8D,aAAA,CAAClC,2BAA2B;IAC1BoC,KAAK,EAAE5B,KAAK,CAACa,gBAAgB,KAAK,UAAU,GAAGJ,mBAAmB,GAAGT,KAAK,CAACQ,KAAM;IACjF+B,OAAO,EAAE,UAAW;IACpBI,YAAY,EAAE3C,KAAK,CAACa,gBAAgB,KAAK,UAAU,GAAGT,WAAW,CAACE,QAAQ,GAAGF,WAAW,CAACwC,OAAQ;IACjGJ,IAAI,EAAExC,KAAK,CAACa,gBAAgB,KAAK,UAAU,GAAG,MAAM,GAAG,QAAS;IAChEZ,QAAQ,EAAED,KAAK,CAACa,gBAAgB,KAAK,UAAU,GAAGS,mBAAmB,GAAGE;EAAmB,CAC5F,CACO,CACC,CAAC;AAElB,CAAC;AAAC3B,OAAA,CAAAC,KAAA,GAAAA,KAAA;AACFA,KAAK,CAAC+C,SAAS,GAAG;EAChB5C,QAAQ,EAAE6C,kBAAS,CAACC,IAAI;EACxB/C,KAAK,EAAE8C,kBAAS,CAACE,MAAM;EACvB9C,WAAW,EAAE4C,kBAAS,CAACE,MAAM;EAC7B7C,WAAW,EAAE2C,kBAAS,CAACE,MAAM;EAC7B5C,WAAW,EAAE0C,kBAAS,CAACE;AACzB,CAAC;AAAC,IAAAC,QAAA,GAAApD,OAAA,CAAAjC,OAAA,GAEakC,KAAK","ignoreList":[]}
|
package/configure/lib/utils.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateValidationMessage = void 0;
|
|
7
|
-
const generateValidationMessage = () => {
|
|
8
|
-
const baselineValidationMessage = '\nThe correct answer should include at least one number line object.';
|
|
9
|
-
return 'Validation requirements:' + baselineValidationMessage;
|
|
10
|
-
};
|
|
11
|
-
exports.generateValidationMessage = generateValidationMessage;
|
|
12
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["generateValidationMessage","baselineValidationMessage","exports"],"sources":["../src/utils.js"],"sourcesContent":["export const generateValidationMessage = () => {\n const baselineValidationMessage =\n '\\nThe correct answer should include at least one number line object.';\n\n return 'Validation requirements:' + baselineValidationMessage;\n};\n"],"mappings":";;;;;;AAAO,MAAMA,yBAAyB,GAAGA,CAAA,KAAM;EAC7C,MAAMC,yBAAyB,GAC7B,sEAAsE;EAExE,OAAO,0BAA0B,GAAGA,yBAAyB;AAC/D,CAAC;AAACC,OAAA,CAAAF,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -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,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA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