@pie-element/ebsr 14.1.1-next.2 → 14.2.0-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/CHANGELOG.json +1547 -0
- package/CHANGELOG.md +2271 -0
- package/LICENSE.md +5 -0
- package/README.md +62 -0
- package/configure/CHANGELOG.json +992 -0
- package/configure/CHANGELOG.md +2136 -0
- package/configure/lib/defaults.js +229 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +154 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +222 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.js +492 -0
- package/{src/author/defaults.ts → configure/src/defaults.js} +0 -10
- package/{src/author/index.ts → configure/src/index.js} +6 -16
- package/{src/author/main.tsx → configure/src/main.jsx} +4 -14
- package/controller/CHANGELOG.json +552 -0
- package/controller/CHANGELOG.md +1275 -0
- package/controller/lib/defaults.js +31 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +448 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +18 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/controller/src/__tests__/index.test.js +591 -0
- package/controller/src/__tests__/utils.test.js +48 -0
- package/{src/controller/defaults.ts → controller/src/defaults.js} +0 -10
- package/{src/controller/index.ts → controller/src/index.js} +3 -13
- package/{src/controller/utils.ts → controller/src/utils.js} +0 -10
- package/docs/config-schema.json +5787 -0
- package/docs/config-schema.json.md +4278 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +52 -0
- package/docs/demo/index.html +2 -0
- package/docs/demo/session.js +14 -0
- package/docs/pie-schema.json +2911 -0
- package/docs/pie-schema.json.md +2142 -0
- package/ebsr.png +0 -0
- package/lib/index.js +207 -0
- package/lib/index.js.map +1 -0
- package/lib/print.js +186 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +5664 -0
- package/module/demo.js +77 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +115 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +18 -59
- package/src/__tests__/index.test.js +129 -0
- package/src/{delivery/index.tsx → index.js} +2 -12
- package/src/{print/index.tsx → print.js} +2 -12
- package/dist/author/defaults.d.ts +0 -67
- package/dist/author/defaults.d.ts.map +0 -1
- package/dist/author/defaults.js +0 -161
- package/dist/author/index.d.ts +0 -35
- package/dist/author/index.d.ts.map +0 -1
- package/dist/author/index.js +0 -78
- package/dist/author/main.d.ts +0 -23
- package/dist/author/main.d.ts.map +0 -1
- package/dist/author/main.js +0 -121
- package/dist/controller/defaults.d.ts +0 -16
- package/dist/controller/defaults.d.ts.map +0 -1
- package/dist/controller/defaults.js +0 -26
- package/dist/controller/index.d.ts +0 -43
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/controller/index.js +0 -186
- package/dist/controller/utils.d.ts +0 -11
- package/dist/controller/utils.d.ts.map +0 -1
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/index.d.ts +0 -27
- package/dist/delivery/index.d.ts.map +0 -1
- package/dist/delivery/index.js +0 -132
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.iife.d.ts +0 -9
- package/dist/index.iife.d.ts.map +0 -1
- package/dist/index.iife.js +0 -165
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +0 -7
- package/dist/print/index.d.ts +0 -26
- package/dist/print/index.d.ts.map +0 -1
- package/dist/print/index.js +0 -107
- package/src/index.iife.ts +0 -16
- package/src/index.ts +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const partModel = base => ({
|
|
8
|
+
choiceMode: 'radio',
|
|
9
|
+
choicePrefix: 'letters',
|
|
10
|
+
choices: [],
|
|
11
|
+
choicesLayout: 'vertical',
|
|
12
|
+
feedbackEnabled: false,
|
|
13
|
+
gridColumns: 2,
|
|
14
|
+
prompt: '',
|
|
15
|
+
promptEnabled: true,
|
|
16
|
+
rationale: '',
|
|
17
|
+
rationaleEnabled: true,
|
|
18
|
+
spellCheckEnabled: true,
|
|
19
|
+
studentInstructionsEnabled: true,
|
|
20
|
+
teacherInstructions: '',
|
|
21
|
+
teacherInstructionsEnabled: true,
|
|
22
|
+
toolbarEditorPosition: 'bottom',
|
|
23
|
+
...base
|
|
24
|
+
});
|
|
25
|
+
var _default = exports.default = {
|
|
26
|
+
partLabels: true,
|
|
27
|
+
partLabelType: 'Letters',
|
|
28
|
+
partA: partModel(),
|
|
29
|
+
partB: partModel()
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["partModel","base","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","prompt","promptEnabled","rationale","rationaleEnabled","spellCheckEnabled","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","_default","exports","default","partLabels","partLabelType","partA","partB"],"sources":["../src/defaults.js"],"sourcesContent":["const partModel = (base) => ({\n choiceMode: 'radio',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n spellCheckEnabled: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n ...base,\n});\n\nexport default {\n partLabels: true,\n partLabelType: 'Letters',\n partA: partModel(),\n partB: partModel(),\n};\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAIC,IAAI,KAAM;EAC3BC,UAAU,EAAE,OAAO;EACnBC,YAAY,EAAE,SAAS;EACvBC,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE,UAAU;EACzBC,eAAe,EAAE,KAAK;EACtBC,WAAW,EAAE,CAAC;EACdC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,IAAI;EACtBC,iBAAiB,EAAE,IAAI;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,mBAAmB,EAAE,EAAE;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,qBAAqB,EAAE,QAAQ;EAC/B,GAAGf;AACL,CAAC,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEY;EACbC,UAAU,EAAE,IAAI;EAChBC,aAAa,EAAE,SAAS;EACxBC,KAAK,EAAEtB,SAAS,CAAC,CAAC;EAClBuB,KAAK,EAAEvB,SAAS,CAAC;AACnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getLogTrace = exports.createDefaultModel = exports.createCorrectResponseSession = void 0;
|
|
8
|
+
exports.model = model;
|
|
9
|
+
exports.normalize = void 0;
|
|
10
|
+
exports.outcome = outcome;
|
|
11
|
+
exports.validate = void 0;
|
|
12
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
13
|
+
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
var _lodashEs = require("lodash-es");
|
|
16
|
+
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
17
|
+
const {
|
|
18
|
+
translator
|
|
19
|
+
} = _translator.default;
|
|
20
|
+
const prepareChoice = (model, env, defaultFeedback) => choice => {
|
|
21
|
+
const out = {
|
|
22
|
+
label: choice.label,
|
|
23
|
+
value: choice.value
|
|
24
|
+
};
|
|
25
|
+
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
26
|
+
out.rationale = model.rationaleEnabled ? choice.rationale : null;
|
|
27
|
+
} else {
|
|
28
|
+
out.rationale = null;
|
|
29
|
+
}
|
|
30
|
+
if (env.mode === 'evaluate') {
|
|
31
|
+
out.correct = !!choice.correct;
|
|
32
|
+
if (model.feedbackEnabled) {
|
|
33
|
+
const feedbackType = choice.feedback && choice.feedback.type || 'none';
|
|
34
|
+
if (feedbackType === 'default') {
|
|
35
|
+
out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];
|
|
36
|
+
} else if (feedbackType === 'custom') {
|
|
37
|
+
out.feedback = choice.feedback.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
};
|
|
43
|
+
const parsePart = (part, key, session, env) => {
|
|
44
|
+
const defaultFeedback = Object.assign({
|
|
45
|
+
correct: 'Correct',
|
|
46
|
+
incorrect: 'Incorrect'
|
|
47
|
+
}, part.defaultFeedback);
|
|
48
|
+
let choices = part.choices ? part.choices.map(prepareChoice(part, env, defaultFeedback)) : [];
|
|
49
|
+
return {
|
|
50
|
+
...part,
|
|
51
|
+
choices,
|
|
52
|
+
disabled: env.mode !== 'gather',
|
|
53
|
+
complete: {
|
|
54
|
+
min: part.choices.filter(c => c.correct).length
|
|
55
|
+
},
|
|
56
|
+
responseCorrect: env.mode === 'evaluate' ? (0, _utils.isResponseCorrect)(part, key, session) : undefined
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const normalizePart = (model, base) => ({
|
|
60
|
+
...base,
|
|
61
|
+
...model,
|
|
62
|
+
choicesLayout: model.choicesLayout || model.verticalMode === false && 'horizontal' || 'vertical'
|
|
63
|
+
});
|
|
64
|
+
const normalize = ({
|
|
65
|
+
partA = {},
|
|
66
|
+
partB = {},
|
|
67
|
+
language,
|
|
68
|
+
...question
|
|
69
|
+
}) => ({
|
|
70
|
+
..._defaults.default,
|
|
71
|
+
...question,
|
|
72
|
+
partA: normalizePart(partA, {
|
|
73
|
+
..._defaults.default.partA,
|
|
74
|
+
language
|
|
75
|
+
}),
|
|
76
|
+
partB: normalizePart(partB, {
|
|
77
|
+
..._defaults.default.partB,
|
|
78
|
+
language
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param {*} question
|
|
85
|
+
* @param {*} session
|
|
86
|
+
* @param {*} env
|
|
87
|
+
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
88
|
+
*/
|
|
89
|
+
exports.normalize = normalize;
|
|
90
|
+
async function model(question, session, env, updateSession) {
|
|
91
|
+
const normalizedQuestion = normalize(question);
|
|
92
|
+
const partA = parsePart(normalizedQuestion.partA, 'partA', session, env);
|
|
93
|
+
const partB = parsePart(normalizedQuestion.partB, 'partB', session, env);
|
|
94
|
+
const shuffledValues = {};
|
|
95
|
+
const us = part => (id, element, update) => new Promise(resolve => {
|
|
96
|
+
shuffledValues[part] = update.shuffledValues;
|
|
97
|
+
resolve();
|
|
98
|
+
});
|
|
99
|
+
const partASession = (0, _lodashEs.get)(session, 'value.partA');
|
|
100
|
+
const partALockChoiceOrder = (0, _controllerUtils.lockChoices)(normalizedQuestion.partA, partASession, env);
|
|
101
|
+
const {
|
|
102
|
+
choices: partAChoices
|
|
103
|
+
} = partA || {};
|
|
104
|
+
const {
|
|
105
|
+
choices: partBChoices
|
|
106
|
+
} = partB || {};
|
|
107
|
+
if (!partALockChoiceOrder && partAChoices && partAChoices.length) {
|
|
108
|
+
partA.choices = await (0, _controllerUtils.getShuffledChoices)(partAChoices, {
|
|
109
|
+
shuffledValues: (session.shuffledValues || {}).partA
|
|
110
|
+
}, us('partA'), 'value');
|
|
111
|
+
}
|
|
112
|
+
const partBSession = (0, _lodashEs.get)(session, 'value.partB');
|
|
113
|
+
const partBLockChoiceOrder = (0, _controllerUtils.lockChoices)(normalizedQuestion.partB, partBSession, env);
|
|
114
|
+
if (!partBLockChoiceOrder && partBChoices && partBChoices.length) {
|
|
115
|
+
partB.choices = await (0, _controllerUtils.getShuffledChoices)(partBChoices, {
|
|
116
|
+
shuffledValues: (session.shuffledValues || {}).partB
|
|
117
|
+
}, us('partB'), 'value');
|
|
118
|
+
}
|
|
119
|
+
if (!(0, _lodashEs.isEmpty)(shuffledValues)) {
|
|
120
|
+
if (updateSession && typeof updateSession === 'function') {
|
|
121
|
+
updateSession(session.id, session.element, {
|
|
122
|
+
shuffledValues
|
|
123
|
+
}).catch(e => {
|
|
124
|
+
// eslint-disable-next-line no-console
|
|
125
|
+
console.error('update session failed', e);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (normalizedQuestion.partLabels) {
|
|
130
|
+
const language = normalizedQuestion.language;
|
|
131
|
+
partA.partLabel = translator.t('ebsr.part', {
|
|
132
|
+
lng: language,
|
|
133
|
+
index: normalizedQuestion.partLabelType === 'Letters' ? 'A' : '1'
|
|
134
|
+
});
|
|
135
|
+
partB.partLabel = translator.t('ebsr.part', {
|
|
136
|
+
lng: language,
|
|
137
|
+
index: normalizedQuestion.partLabelType === 'Letters' ? 'B' : '2'
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
partA.partLabel = undefined;
|
|
141
|
+
partB.partLabel = undefined;
|
|
142
|
+
}
|
|
143
|
+
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
144
|
+
partA.teacherInstructions = normalizedQuestion.partA.teacherInstructionsEnabled ? normalizedQuestion.partA.teacherInstructions : null;
|
|
145
|
+
partB.teacherInstructions = normalizedQuestion.partB.teacherInstructionsEnabled ? normalizedQuestion.partB.teacherInstructions : null;
|
|
146
|
+
} else {
|
|
147
|
+
partA.teacherInstructions = null;
|
|
148
|
+
partB.teacherInstructions = null;
|
|
149
|
+
}
|
|
150
|
+
partA.prompt = normalizedQuestion.partA.promptEnabled ? normalizedQuestion.partA.prompt : null;
|
|
151
|
+
partB.prompt = normalizedQuestion.partB.promptEnabled ? normalizedQuestion.partB.prompt : null;
|
|
152
|
+
return new Promise(resolve => {
|
|
153
|
+
resolve({
|
|
154
|
+
disabled: env.mode !== 'gather',
|
|
155
|
+
mode: env.mode,
|
|
156
|
+
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
157
|
+
partA,
|
|
158
|
+
partB
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const createDefaultModel = (model = {}) => new Promise(resolve => {
|
|
163
|
+
resolve({
|
|
164
|
+
..._defaults.default,
|
|
165
|
+
...model
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
exports.createDefaultModel = createDefaultModel;
|
|
169
|
+
const isCorrect = c => c.correct === true;
|
|
170
|
+
const getScore = (config, sessionPart, key, partialScoringEnabled) => {
|
|
171
|
+
const {
|
|
172
|
+
choices = []
|
|
173
|
+
} = config && config[key] || {};
|
|
174
|
+
const maxScore = choices.length;
|
|
175
|
+
const {
|
|
176
|
+
value: sessionPartValue
|
|
177
|
+
} = sessionPart || {};
|
|
178
|
+
const chosen = c => !!(sessionPartValue || []).find(v => v === c.value);
|
|
179
|
+
const correctAndNotChosen = c => isCorrect(c) && !chosen(c);
|
|
180
|
+
const incorrectAndChosen = c => !isCorrect(c) && chosen(c);
|
|
181
|
+
const correctChoices = choices.reduce((total, choice) => {
|
|
182
|
+
if (correctAndNotChosen(choice) || incorrectAndChosen(choice)) {
|
|
183
|
+
return total - 1;
|
|
184
|
+
} else {
|
|
185
|
+
return total;
|
|
186
|
+
}
|
|
187
|
+
}, choices.length);
|
|
188
|
+
|
|
189
|
+
// determine score for a part
|
|
190
|
+
if (!partialScoringEnabled && correctChoices < maxScore) {
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
return parseFloat(maxScore ? (correctChoices / maxScore).toFixed(2) : 0);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Generates detailed trace log for math-templated scoring evaluation
|
|
198
|
+
* @param {Object} question
|
|
199
|
+
* @param {Object} session
|
|
200
|
+
* @param {Object} env
|
|
201
|
+
* @returns {Array<string>} traceLog
|
|
202
|
+
*/
|
|
203
|
+
const getLogTrace = (question, session, env) => {
|
|
204
|
+
const traceLog = [];
|
|
205
|
+
if (!session || !session.value) {
|
|
206
|
+
traceLog.push('Student did not answer the question.');
|
|
207
|
+
return traceLog;
|
|
208
|
+
}
|
|
209
|
+
const {
|
|
210
|
+
value
|
|
211
|
+
} = session;
|
|
212
|
+
const {
|
|
213
|
+
partA,
|
|
214
|
+
partB
|
|
215
|
+
} = value;
|
|
216
|
+
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(question, env);
|
|
217
|
+
traceLog.push(`Scoring method: ${partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'}.`);
|
|
218
|
+
const partAquestionType = question.partA.choiceMode === 'radio' ? 'multiple-choice (radio)' : 'multiple-select (checkbox)';
|
|
219
|
+
traceLog.push(`Part A question type: ${partAquestionType}.`);
|
|
220
|
+
const partASelections = partA?.value || [];
|
|
221
|
+
const partACorrectChoices = (question.partA.choices || []).filter(c => c.correct);
|
|
222
|
+
const partACorrectValues = partACorrectChoices.map(c => c.value);
|
|
223
|
+
const partACorrectSelected = partASelections.filter(v => partACorrectValues.includes(v));
|
|
224
|
+
const partAIncorrectSelected = partASelections.filter(v => !partACorrectValues.includes(v));
|
|
225
|
+
if (partASelections.length) {
|
|
226
|
+
traceLog.push(`Part A: student selected ${partASelections.length} choice(s) (${partACorrectSelected.length} correct, ${partAIncorrectSelected.length} incorrect).`);
|
|
227
|
+
}
|
|
228
|
+
const scoreA = getScore(question, partA, 'partA', partialScoringEnabled);
|
|
229
|
+
traceLog.push(`Part A score: ${scoreA}.`);
|
|
230
|
+
const partBquestionType = question.partB.choiceMode === 'radio' ? 'multiple-choice (radio)' : 'multiple-select (checkbox)';
|
|
231
|
+
traceLog.push(`Part B question type: ${partBquestionType}.`);
|
|
232
|
+
const partBSelections = partB?.value || [];
|
|
233
|
+
const partBCorrectChoices = (question.partB.choices || []).filter(c => c.correct);
|
|
234
|
+
const partBCorrectValues = partBCorrectChoices.map(c => c.value);
|
|
235
|
+
const correctSelected = partBSelections.filter(v => partBCorrectValues.includes(v));
|
|
236
|
+
const incorrectSelected = partBSelections.filter(v => !partBCorrectValues.includes(v));
|
|
237
|
+
if (partBSelections.length) {
|
|
238
|
+
traceLog.push(`Part B: student selected ${partBSelections.length} choice(s) (${correctSelected.length} correct, ${incorrectSelected.length} incorrect).`);
|
|
239
|
+
}
|
|
240
|
+
const scoreB = getScore(question, partB, 'partB', partialScoringEnabled);
|
|
241
|
+
traceLog.push(`Part B score: ${scoreB}.`);
|
|
242
|
+
if (!partialScoringEnabled) {
|
|
243
|
+
traceLog.push('Final score is awarded only if both Part A and Part B are completely correct.');
|
|
244
|
+
traceLog.push(`Final score: ${scoreA === 1 && scoreB === 1 ? 1 : 0}.`);
|
|
245
|
+
} else {
|
|
246
|
+
traceLog.push('With partial scoring enabled, Part A must be correct to earn any credit.');
|
|
247
|
+
let finalScore = 0;
|
|
248
|
+
if (scoreA === 1 && scoreB === 1) {
|
|
249
|
+
finalScore = 2;
|
|
250
|
+
} else if (scoreA === 1 && scoreB < 1) {
|
|
251
|
+
finalScore = 1;
|
|
252
|
+
}
|
|
253
|
+
traceLog.push(`Final score: ${finalScore}.`);
|
|
254
|
+
}
|
|
255
|
+
return traceLog;
|
|
256
|
+
};
|
|
257
|
+
exports.getLogTrace = getLogTrace;
|
|
258
|
+
function outcome(config, session, env) {
|
|
259
|
+
return new Promise(resolve => {
|
|
260
|
+
const {
|
|
261
|
+
value
|
|
262
|
+
} = session || {};
|
|
263
|
+
if (!session || !value) {
|
|
264
|
+
resolve({
|
|
265
|
+
score: 0,
|
|
266
|
+
scoreA: 0,
|
|
267
|
+
scoreB: 0,
|
|
268
|
+
empty: true,
|
|
269
|
+
logTrace: ['Student did not answer the question.']
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
if (value) {
|
|
273
|
+
const {
|
|
274
|
+
partA,
|
|
275
|
+
partB
|
|
276
|
+
} = value || {};
|
|
277
|
+
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(config, env);
|
|
278
|
+
const scoreA = getScore(config, partA, 'partA', partialScoringEnabled);
|
|
279
|
+
const scoreB = getScore(config, partB, 'partB', partialScoringEnabled);
|
|
280
|
+
const logTrace = getLogTrace(config, session, env);
|
|
281
|
+
if (!partialScoringEnabled) {
|
|
282
|
+
// The EBSR item is worth 1 point
|
|
283
|
+
// That point is awarded if and only if both parts are fully correct, otherwise no points are awarded
|
|
284
|
+
resolve({
|
|
285
|
+
score: scoreA === 1 && scoreB === 1 ? 1 : 0,
|
|
286
|
+
scoreA,
|
|
287
|
+
scoreB,
|
|
288
|
+
max: 1,
|
|
289
|
+
logTrace
|
|
290
|
+
});
|
|
291
|
+
} else {
|
|
292
|
+
// The EBSR item is worth 2 points
|
|
293
|
+
if (scoreA === 1) {
|
|
294
|
+
if (scoreB === 1) {
|
|
295
|
+
// If Part A and Part B are both correct, 2 points are awarded
|
|
296
|
+
resolve({
|
|
297
|
+
score: 2,
|
|
298
|
+
scoreA,
|
|
299
|
+
scoreB,
|
|
300
|
+
max: 2,
|
|
301
|
+
logTrace
|
|
302
|
+
});
|
|
303
|
+
} else {
|
|
304
|
+
// If Part A is correct and part B is incorrect, 1 point is awarded
|
|
305
|
+
resolve({
|
|
306
|
+
score: 1,
|
|
307
|
+
scoreA,
|
|
308
|
+
scoreB,
|
|
309
|
+
max: 2,
|
|
310
|
+
logTrace
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
// For all other combinations, no points are awarded
|
|
315
|
+
resolve({
|
|
316
|
+
score: 0,
|
|
317
|
+
scoreA,
|
|
318
|
+
scoreB,
|
|
319
|
+
max: 2,
|
|
320
|
+
logTrace
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
const returnPartCorrect = choices => {
|
|
328
|
+
let answers = [];
|
|
329
|
+
choices.forEach(i => {
|
|
330
|
+
const {
|
|
331
|
+
correct,
|
|
332
|
+
value
|
|
333
|
+
} = i;
|
|
334
|
+
if (correct) {
|
|
335
|
+
answers.push(value);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
return answers;
|
|
339
|
+
};
|
|
340
|
+
const createCorrectResponseSession = (question, env) => {
|
|
341
|
+
return new Promise(resolve => {
|
|
342
|
+
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
343
|
+
const {
|
|
344
|
+
partA,
|
|
345
|
+
partB
|
|
346
|
+
} = question;
|
|
347
|
+
const partACorrect = returnPartCorrect(partA.choices);
|
|
348
|
+
const partBCorrect = returnPartCorrect(partB.choices);
|
|
349
|
+
resolve({
|
|
350
|
+
value: {
|
|
351
|
+
partA: {
|
|
352
|
+
id: 'partA',
|
|
353
|
+
value: partACorrect
|
|
354
|
+
},
|
|
355
|
+
partB: {
|
|
356
|
+
id: 'partB',
|
|
357
|
+
value: partBCorrect
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
id: '1'
|
|
361
|
+
});
|
|
362
|
+
} else {
|
|
363
|
+
resolve(null);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// remove all html tags
|
|
369
|
+
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
370
|
+
const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
|
|
371
|
+
|
|
372
|
+
// remove all html tags except img, iframe and source tag for audio
|
|
373
|
+
const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
374
|
+
const validatePart = (model = {}, config = {}) => {
|
|
375
|
+
const {
|
|
376
|
+
choices
|
|
377
|
+
} = model;
|
|
378
|
+
const {
|
|
379
|
+
minAnswerChoices = 2,
|
|
380
|
+
maxAnswerChoices
|
|
381
|
+
} = config;
|
|
382
|
+
const reversedChoices = [...(choices || [])].reverse();
|
|
383
|
+
const errors = {};
|
|
384
|
+
const choicesErrors = {};
|
|
385
|
+
const rationaleErrors = {};
|
|
386
|
+
let hasCorrectResponse = false;
|
|
387
|
+
['teacherInstructions', 'prompt'].forEach(field => {
|
|
388
|
+
if (config[field]?.required && !getContent(model[field])) {
|
|
389
|
+
errors[field] = 'This field is required.';
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
reversedChoices.forEach((choice, index) => {
|
|
393
|
+
const {
|
|
394
|
+
correct,
|
|
395
|
+
value,
|
|
396
|
+
label,
|
|
397
|
+
rationale
|
|
398
|
+
} = choice;
|
|
399
|
+
if (correct) {
|
|
400
|
+
hasCorrectResponse = true;
|
|
401
|
+
}
|
|
402
|
+
if (!getContent(label)) {
|
|
403
|
+
choicesErrors[value] = 'Content should not be empty.';
|
|
404
|
+
} else {
|
|
405
|
+
const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);
|
|
406
|
+
if (identicalAnswer) {
|
|
407
|
+
choicesErrors[value] = 'Content should be unique.';
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (config.rationale?.required && !getContent(rationale)) {
|
|
411
|
+
rationaleErrors[value] = 'This field is required.';
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
const nbOfChoices = (choices || []).length;
|
|
415
|
+
if (nbOfChoices < minAnswerChoices) {
|
|
416
|
+
errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;
|
|
417
|
+
} else if (nbOfChoices > maxAnswerChoices) {
|
|
418
|
+
errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;
|
|
419
|
+
}
|
|
420
|
+
if (!hasCorrectResponse) {
|
|
421
|
+
errors.correctResponse = 'No correct response defined.';
|
|
422
|
+
}
|
|
423
|
+
if (!(0, _lodashEs.isEmpty)(choicesErrors)) {
|
|
424
|
+
errors.choices = choicesErrors;
|
|
425
|
+
}
|
|
426
|
+
if (!(0, _lodashEs.isEmpty)(rationaleErrors)) {
|
|
427
|
+
errors.rationale = rationaleErrors;
|
|
428
|
+
}
|
|
429
|
+
return errors;
|
|
430
|
+
};
|
|
431
|
+
const validate = (model = {}, config = {}) => {
|
|
432
|
+
const {
|
|
433
|
+
partA,
|
|
434
|
+
partB
|
|
435
|
+
} = model || {};
|
|
436
|
+
const {
|
|
437
|
+
partA: partAConfig,
|
|
438
|
+
partB: partBConfig
|
|
439
|
+
} = config || {};
|
|
440
|
+
const partAErrors = validatePart(partA, partAConfig);
|
|
441
|
+
const partBErrors = validatePart(partB, partBConfig);
|
|
442
|
+
return {
|
|
443
|
+
partA: partAErrors,
|
|
444
|
+
partB: partBErrors
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
exports.validate = validate;
|
|
448
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_defaults","_interopRequireDefault","require","_controllerUtils","_utils","_lodashEs","_translator","translator","Translator","prepareChoice","model","env","defaultFeedback","choice","out","label","value","role","mode","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","parsePart","part","key","session","Object","assign","incorrect","choices","map","disabled","complete","min","filter","c","length","responseCorrect","isResponseCorrect","undefined","normalizePart","base","choicesLayout","verticalMode","normalize","partA","partB","language","question","defaults","exports","updateSession","normalizedQuestion","shuffledValues","us","id","element","update","Promise","resolve","partASession","get","partALockChoiceOrder","lockChoices","partAChoices","partBChoices","getShuffledChoices","partBSession","partBLockChoiceOrder","isEmpty","catch","e","console","error","partLabels","partLabel","t","lng","index","partLabelType","teacherInstructions","teacherInstructionsEnabled","prompt","promptEnabled","extraCSSRules","createDefaultModel","isCorrect","getScore","config","sessionPart","partialScoringEnabled","maxScore","sessionPartValue","chosen","find","v","correctAndNotChosen","incorrectAndChosen","correctChoices","reduce","total","parseFloat","toFixed","getLogTrace","traceLog","push","partialScoring","enabled","partAquestionType","choiceMode","partASelections","partACorrectChoices","partACorrectValues","partACorrectSelected","includes","partAIncorrectSelected","scoreA","partBquestionType","partBSelections","partBCorrectChoices","partBCorrectValues","correctSelected","incorrectSelected","scoreB","finalScore","outcome","score","empty","logTrace","max","returnPartCorrect","answers","forEach","i","createCorrectResponseSession","partACorrect","partBCorrect","getInnerText","html","replaceAll","getContent","replace","validatePart","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","errors","choicesErrors","rationaleErrors","hasCorrectResponse","field","required","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse","validate","partAConfig","partBConfig","partAErrors","partBErrors"],"sources":["../src/index.js"],"sourcesContent":["import defaults from './defaults';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport { isResponseCorrect } from './utils';\nimport { get, isEmpty } from 'lodash-es';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (env.mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nconst parsePart = (part, key, session, env) => {\n const defaultFeedback = Object.assign({ correct: 'Correct', incorrect: 'Incorrect' }, part.defaultFeedback);\n\n let choices = part.choices ? part.choices.map(prepareChoice(part, env, defaultFeedback)) : [];\n\n return {\n ...part,\n choices,\n disabled: env.mode !== 'gather',\n complete: {\n min: part.choices.filter((c) => c.correct).length,\n },\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(part, key, session) : undefined,\n };\n};\n\nconst normalizePart = (model, base) => ({\n ...base,\n ...model,\n choicesLayout: model.choicesLayout || (model.verticalMode === false && 'horizontal') || 'vertical',\n});\n\nexport const normalize = ({ partA = {}, partB = {}, language, ...question }) => ({\n ...defaults,\n ...question,\n partA: normalizePart(partA, { ...defaults.partA, language }),\n partB: normalizePart(partB, { ...defaults.partB, language }),\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n const partA = parsePart(normalizedQuestion.partA, 'partA', session, env);\n const partB = parsePart(normalizedQuestion.partB, 'partB', session, env);\n\n const shuffledValues = {};\n\n const us = (part) => (id, element, update) =>\n new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n\n const partASession = get(session, 'value.partA');\n const partALockChoiceOrder = lockChoices(normalizedQuestion.partA, partASession, env);\n\n const { choices: partAChoices } = partA || {};\n const { choices: partBChoices } = partB || {};\n\n if (!partALockChoiceOrder && partAChoices && partAChoices.length) {\n partA.choices = await getShuffledChoices(\n partAChoices,\n { shuffledValues: (session.shuffledValues || {}).partA },\n us('partA'),\n 'value',\n );\n }\n\n const partBSession = get(session, 'value.partB');\n const partBLockChoiceOrder = lockChoices(normalizedQuestion.partB, partBSession, env);\n\n if (!partBLockChoiceOrder && partBChoices && partBChoices.length) {\n partB.choices = await getShuffledChoices(\n partBChoices,\n { shuffledValues: (session.shuffledValues || {}).partB },\n us('partB'),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n\n if (normalizedQuestion.partLabels) {\n const language = normalizedQuestion.language;\n partA.partLabel = translator.t('ebsr.part', {\n lng: language,\n index: normalizedQuestion.partLabelType === 'Letters' ? 'A' : '1',\n });\n partB.partLabel = translator.t('ebsr.part', {\n lng: language,\n index: normalizedQuestion.partLabelType === 'Letters' ? 'B' : '2',\n });\n } else {\n partA.partLabel = undefined;\n partB.partLabel = undefined;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n partA.teacherInstructions = normalizedQuestion.partA.teacherInstructionsEnabled\n ? normalizedQuestion.partA.teacherInstructions\n : null;\n partB.teacherInstructions = normalizedQuestion.partB.teacherInstructionsEnabled\n ? normalizedQuestion.partB.teacherInstructions\n : null;\n } else {\n partA.teacherInstructions = null;\n partB.teacherInstructions = null;\n }\n\n partA.prompt = normalizedQuestion.partA.promptEnabled ? normalizedQuestion.partA.prompt : null;\n partB.prompt = normalizedQuestion.partB.promptEnabled ? normalizedQuestion.partB.prompt : null;\n\n return new Promise((resolve) => {\n resolve({\n disabled: env.mode !== 'gather',\n mode: env.mode,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n partA,\n partB,\n });\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nconst isCorrect = (c) => c.correct === true;\n\nconst getScore = (config, sessionPart, key, partialScoringEnabled) => {\n const { choices = [] } = (config && config[key]) || {};\n const maxScore = choices.length;\n const { value: sessionPartValue } = sessionPart || {};\n\n const chosen = (c) => !!(sessionPartValue || []).find((v) => v === c.value);\n const correctAndNotChosen = (c) => isCorrect(c) && !chosen(c);\n const incorrectAndChosen = (c) => !isCorrect(c) && chosen(c);\n const correctChoices = choices.reduce((total, choice) => {\n if (correctAndNotChosen(choice) || incorrectAndChosen(choice)) {\n return total - 1;\n } else {\n return total;\n }\n }, choices.length);\n\n // determine score for a part\n if (!partialScoringEnabled && correctChoices < maxScore) {\n return 0;\n }\n\n return parseFloat(maxScore ? (correctChoices / maxScore).toFixed(2) : 0);\n};\n\n/**\n * Generates detailed trace log for math-templated scoring evaluation\n * @param {Object} question\n * @param {Object} session\n * @param {Object} env\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n if (!session || !session.value) {\n traceLog.push('Student did not answer the question.');\n return traceLog;\n }\n\n const { value } = session;\n const { partA, partB } = value;\n\n const partialScoringEnabled = partialScoring.enabled(question, env);\n\n traceLog.push(\n `Scoring method: ${partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'}.`\n );\n\n const partAquestionType =\n question.partA.choiceMode === 'radio'\n ? 'multiple-choice (radio)'\n : 'multiple-select (checkbox)';\n traceLog.push(`Part A question type: ${partAquestionType}.`);\n\n const partASelections = partA?.value || [];\n const partACorrectChoices = (question.partA.choices || []).filter((c) => c.correct);\n const partACorrectValues = partACorrectChoices.map((c) => c.value);\n const partACorrectSelected = partASelections.filter((v) => partACorrectValues.includes(v));\n const partAIncorrectSelected = partASelections.filter((v) => !partACorrectValues.includes(v));\n\n if (partASelections.length) {\n traceLog.push(\n `Part A: student selected ${partASelections.length} choice(s) (${partACorrectSelected.length} correct, ${partAIncorrectSelected.length} incorrect).`\n );\n }\n \n const scoreA = getScore(question, partA, 'partA', partialScoringEnabled);\n traceLog.push(`Part A score: ${scoreA}.`);\n\n const partBquestionType =\n question.partB.choiceMode === 'radio'\n ? 'multiple-choice (radio)'\n : 'multiple-select (checkbox)';\n traceLog.push(`Part B question type: ${partBquestionType}.`);\n\n const partBSelections = partB?.value || [];\n const partBCorrectChoices = (question.partB.choices || []).filter((c) => c.correct);\n const partBCorrectValues = partBCorrectChoices.map((c) => c.value);\n const correctSelected = partBSelections.filter((v) => partBCorrectValues.includes(v));\n const incorrectSelected = partBSelections.filter((v) => !partBCorrectValues.includes(v));\n\n if (partBSelections.length) {\n traceLog.push(\n `Part B: student selected ${partBSelections.length} choice(s) (${correctSelected.length} correct, ${incorrectSelected.length} incorrect).`\n );\n }\n\n const scoreB = getScore(question, partB, 'partB', partialScoringEnabled);\n traceLog.push(`Part B score: ${scoreB}.`);\n\n if (!partialScoringEnabled) {\n traceLog.push(\n 'Final score is awarded only if both Part A and Part B are completely correct.'\n );\n traceLog.push(`Final score: ${scoreA === 1 && scoreB === 1 ? 1 : 0}.`);\n } else {\n traceLog.push(\n 'With partial scoring enabled, Part A must be correct to earn any credit.'\n );\n\n let finalScore = 0;\n if (scoreA === 1 && scoreB === 1) {\n finalScore = 2;\n } else if (scoreA === 1 && scoreB < 1) {\n finalScore = 1;\n }\n\n traceLog.push(`Final score: ${finalScore}.`);\n }\n\n return traceLog;\n};\n\nexport function outcome(config, session, env) {\n return new Promise((resolve) => {\n const { value } = session || {};\n\n if (!session || !value) {\n resolve({ score: 0, scoreA: 0, scoreB: 0, empty: true, logTrace: ['Student did not answer the question.'] });\n }\n\n if (value) {\n const { partA, partB } = value || {};\n\n const partialScoringEnabled = partialScoring.enabled(config, env);\n\n const scoreA = getScore(config, partA, 'partA', partialScoringEnabled);\n const scoreB = getScore(config, partB, 'partB', partialScoringEnabled);\n const logTrace = getLogTrace(config, session, env);\n\n if (!partialScoringEnabled) {\n // The EBSR item is worth 1 point\n // That point is awarded if and only if both parts are fully correct, otherwise no points are awarded\n resolve({ score: scoreA === 1 && scoreB === 1 ? 1 : 0, scoreA, scoreB, max: 1, logTrace });\n } else {\n // The EBSR item is worth 2 points\n if (scoreA === 1) {\n if (scoreB === 1) {\n // If Part A and Part B are both correct, 2 points are awarded\n resolve({ score: 2, scoreA, scoreB, max: 2, logTrace });\n } else {\n // If Part A is correct and part B is incorrect, 1 point is awarded\n resolve({ score: 1, scoreA, scoreB, max: 2, logTrace });\n }\n } else {\n // For all other combinations, no points are awarded\n resolve({ score: 0, scoreA, scoreB, max: 2, logTrace });\n }\n }\n }\n });\n}\n\nconst returnPartCorrect = (choices) => {\n let answers = [];\n\n choices.forEach((i) => {\n const { correct, value } = i;\n if (correct) {\n answers.push(value);\n }\n });\n return answers;\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { partA, partB } = question;\n\n const partACorrect = returnPartCorrect(partA.choices);\n const partBCorrect = returnPartCorrect(partB.choices);\n\n resolve({\n value: {\n partA: {\n id: 'partA',\n value: partACorrect,\n },\n partB: {\n id: 'partB',\n value: partBCorrect,\n },\n },\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\nconst validatePart = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const rationaleErrors = {};\n let hasCorrectResponse = false;\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 reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { partA, partB } = model || {};\n const { partA: partAConfig, partB: partBConfig } = config || {};\n\n const partAErrors = validatePart(partA, partAConfig);\n const partBErrors = validatePart(partB, partBConfig);\n\n return { partA: partAErrors, partB: partBErrors };\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,MAAM;EAAEK;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,aAAa,GAAGA,CAACC,KAAK,EAAEC,GAAG,EAAEC,eAAe,KAAMC,MAAM,IAAK;EACjE,MAAMC,GAAG,GAAG;IACVC,KAAK,EAAEF,MAAM,CAACE,KAAK;IACnBC,KAAK,EAAEH,MAAM,CAACG;EAChB,CAAC;EAED,IAAIL,GAAG,CAACM,IAAI,KAAK,YAAY,KAAKN,GAAG,CAACO,IAAI,KAAK,MAAM,IAAIP,GAAG,CAACO,IAAI,KAAK,UAAU,CAAC,EAAE;IACjFJ,GAAG,CAACK,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GAAGrB,YAAY,CAAChG,KAAK,EAAEmH,WAAW,CAAC;EAEpD,OAAO;IAAEpH,KAAK,EAAEqH,WAAW;IAAEpH,KAAK,EAAEqH;EAAY,CAAC;AACnD,CAAC;AAACjH,OAAA,CAAA6G,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isResponseCorrect = exports.getCorrectResponse = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
const getCorrectResponse = choices => choices && choices.filter(c => c.correct).map(c => c.value).sort();
|
|
9
|
+
exports.getCorrectResponse = getCorrectResponse;
|
|
10
|
+
const isResponseCorrect = (question, key, session) => {
|
|
11
|
+
let correctResponse = getCorrectResponse(question.choices);
|
|
12
|
+
if (session && session.value) {
|
|
13
|
+
return (0, _lodashEs.isEqual)((session.value[key].value || []).sort(), correctResponse);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
exports.isResponseCorrect = isResponseCorrect;
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_lodashEs","require","getCorrectResponse","choices","filter","c","correct","map","value","sort","exports","isResponseCorrect","question","key","session","correctResponse","isEqual"],"sources":["../src/utils.js"],"sourcesContent":["import { isEqual } from 'lodash-es';\n\nexport const getCorrectResponse = (choices) =>\n choices &&\n choices\n .filter((c) => c.correct)\n .map((c) => c.value)\n .sort();\n\nexport const isResponseCorrect = (question, key, session) => {\n let correctResponse = getCorrectResponse(question.choices);\n\n if (session && session.value) {\n return isEqual((session.value[key].value || []).sort(), correctResponse);\n }\n\n return false;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,OAAO,IACxCA,OAAO,IACPA,OAAO,CACJC,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CACxBC,GAAG,CAAEF,CAAC,IAAKA,CAAC,CAACG,KAAK,CAAC,CACnBC,IAAI,CAAC,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA;AAEL,MAAMS,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,GAAG,EAAEC,OAAO,KAAK;EAC3D,IAAIC,eAAe,GAAGb,kBAAkB,CAACU,QAAQ,CAACT,OAAO,CAAC;EAE1D,IAAIW,OAAO,IAAIA,OAAO,CAACN,KAAK,EAAE;IAC5B,OAAO,IAAAQ,iBAAO,EAAC,CAACF,OAAO,CAACN,KAAK,CAACK,GAAG,CAAC,CAACL,KAAK,IAAI,EAAE,EAAEC,IAAI,CAAC,CAAC,EAAEM,eAAe,CAAC;EAC1E;EAEA,OAAO,KAAK;AACd,CAAC;AAACL,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/ebsr-controller",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "11.1.0-next.1",
|
|
5
|
+
"description": "",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@pie-lib/controller-utils": "2.0.2-next.0",
|
|
11
|
+
"@pie-lib/translator": "4.0.2-next.0",
|
|
12
|
+
"lodash-es": "^4.17.23"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"main": "lib/index.js",
|
|
17
|
+
"module": "src/index.js"
|
|
18
|
+
}
|