@pie-element/ebsr 12.0.1 → 12.1.0
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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +3 -3
- package/package.json +6 -24
- package/esm/configure.js +0 -8054
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -549
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -163
- package/esm/element.js.map +0 -1
- package/esm/print.js +0 -209
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -6466
- package/module/demo.js +0 -77
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -115
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/esm/controller.js
DELETED
|
@@ -1,549 +0,0 @@
|
|
|
1
|
-
import { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';
|
|
2
|
-
import isEqual from 'lodash/isEqual';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
|
-
import Translator from '@pie-lib/translator';
|
|
6
|
-
|
|
7
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8
|
-
try {
|
|
9
|
-
var info = gen[key](arg);
|
|
10
|
-
var value = info.value;
|
|
11
|
-
} catch (error) {
|
|
12
|
-
reject(error);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (info.done) {
|
|
17
|
-
resolve(value);
|
|
18
|
-
} else {
|
|
19
|
-
Promise.resolve(value).then(_next, _throw);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function _asyncToGenerator(fn) {
|
|
24
|
-
return function () {
|
|
25
|
-
var self = this,
|
|
26
|
-
args = arguments;
|
|
27
|
-
return new Promise(function (resolve, reject) {
|
|
28
|
-
var gen = fn.apply(self, args);
|
|
29
|
-
|
|
30
|
-
function _next(value) {
|
|
31
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _throw(err) {
|
|
35
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_next(undefined);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
44
|
-
if (source == null) return {};
|
|
45
|
-
var target = {};
|
|
46
|
-
var sourceKeys = Object.keys(source);
|
|
47
|
-
var key, i;
|
|
48
|
-
|
|
49
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
50
|
-
key = sourceKeys[i];
|
|
51
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
52
|
-
target[key] = source[key];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return target;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _objectWithoutProperties(source, excluded) {
|
|
59
|
-
if (source == null) return {};
|
|
60
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
61
|
-
var key, i;
|
|
62
|
-
|
|
63
|
-
if (Object.getOwnPropertySymbols) {
|
|
64
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
65
|
-
|
|
66
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
67
|
-
key = sourceSymbolKeys[i];
|
|
68
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
69
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
70
|
-
target[key] = source[key];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _defineProperty(obj, key, value) {
|
|
78
|
-
if (key in obj) {
|
|
79
|
-
Object.defineProperty(obj, key, {
|
|
80
|
-
value: value,
|
|
81
|
-
enumerable: true,
|
|
82
|
-
configurable: true,
|
|
83
|
-
writable: true
|
|
84
|
-
});
|
|
85
|
-
} else {
|
|
86
|
-
obj[key] = value;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return obj;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
93
|
-
|
|
94
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
95
|
-
|
|
96
|
-
var partModel = base => _objectSpread$1({
|
|
97
|
-
choiceMode: 'radio',
|
|
98
|
-
choicePrefix: 'letters',
|
|
99
|
-
choices: [],
|
|
100
|
-
choicesLayout: 'vertical',
|
|
101
|
-
feedbackEnabled: false,
|
|
102
|
-
gridColumns: 2,
|
|
103
|
-
prompt: '',
|
|
104
|
-
promptEnabled: true,
|
|
105
|
-
rationale: '',
|
|
106
|
-
rationaleEnabled: true,
|
|
107
|
-
spellCheckEnabled: true,
|
|
108
|
-
studentInstructionsEnabled: true,
|
|
109
|
-
teacherInstructions: '',
|
|
110
|
-
teacherInstructionsEnabled: true,
|
|
111
|
-
toolbarEditorPosition: 'bottom'
|
|
112
|
-
}, base);
|
|
113
|
-
|
|
114
|
-
var defaults = {
|
|
115
|
-
partLabels: true,
|
|
116
|
-
partLabelType: 'Letters',
|
|
117
|
-
partA: partModel(),
|
|
118
|
-
partB: partModel()
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
var getCorrectResponse = choices => choices && choices.filter(c => c.correct).map(c => c.value).sort();
|
|
122
|
-
var isResponseCorrect = (question, key, session) => {
|
|
123
|
-
var correctResponse = getCorrectResponse(question.choices);
|
|
124
|
-
|
|
125
|
-
if (session && session.value) {
|
|
126
|
-
return isEqual((session.value[key].value || []).sort(), correctResponse);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return false;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
var _excluded = ["partA", "partB", "language"];
|
|
133
|
-
|
|
134
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
135
|
-
|
|
136
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
137
|
-
var {
|
|
138
|
-
translator
|
|
139
|
-
} = Translator;
|
|
140
|
-
|
|
141
|
-
var prepareChoice = (model, env, defaultFeedback) => choice => {
|
|
142
|
-
var out = {
|
|
143
|
-
label: choice.label,
|
|
144
|
-
value: choice.value
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
148
|
-
out.rationale = model.rationaleEnabled ? choice.rationale : null;
|
|
149
|
-
} else {
|
|
150
|
-
out.rationale = null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (env.mode === 'evaluate') {
|
|
154
|
-
out.correct = !!choice.correct;
|
|
155
|
-
|
|
156
|
-
if (model.feedbackEnabled) {
|
|
157
|
-
var feedbackType = choice.feedback && choice.feedback.type || 'none';
|
|
158
|
-
|
|
159
|
-
if (feedbackType === 'default') {
|
|
160
|
-
out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];
|
|
161
|
-
} else if (feedbackType === 'custom') {
|
|
162
|
-
out.feedback = choice.feedback.value;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return out;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
var parsePart = (part, key, session, env) => {
|
|
171
|
-
var defaultFeedback = Object.assign({
|
|
172
|
-
correct: 'Correct',
|
|
173
|
-
incorrect: 'Incorrect'
|
|
174
|
-
}, part.defaultFeedback);
|
|
175
|
-
var choices = part.choices ? part.choices.map(prepareChoice(part, env, defaultFeedback)) : [];
|
|
176
|
-
return _objectSpread(_objectSpread({}, part), {}, {
|
|
177
|
-
choices,
|
|
178
|
-
disabled: env.mode !== 'gather',
|
|
179
|
-
complete: {
|
|
180
|
-
min: part.choices.filter(c => c.correct).length
|
|
181
|
-
},
|
|
182
|
-
responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(part, key, session) : undefined
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
var normalizePart = (model, base) => _objectSpread(_objectSpread(_objectSpread({}, base), model), {}, {
|
|
187
|
-
choicesLayout: model.choicesLayout || model.verticalMode === false && 'horizontal' || 'vertical'
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
var normalize = _ref => {
|
|
191
|
-
var {
|
|
192
|
-
partA = {},
|
|
193
|
-
partB = {},
|
|
194
|
-
language
|
|
195
|
-
} = _ref,
|
|
196
|
-
question = _objectWithoutProperties(_ref, _excluded);
|
|
197
|
-
|
|
198
|
-
return _objectSpread(_objectSpread(_objectSpread({}, defaults), question), {}, {
|
|
199
|
-
partA: normalizePart(partA, _objectSpread(_objectSpread({}, defaults.partA), {}, {
|
|
200
|
-
language
|
|
201
|
-
})),
|
|
202
|
-
partB: normalizePart(partB, _objectSpread(_objectSpread({}, defaults.partB), {}, {
|
|
203
|
-
language
|
|
204
|
-
}))
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
*
|
|
209
|
-
* @param {*} question
|
|
210
|
-
* @param {*} session
|
|
211
|
-
* @param {*} env
|
|
212
|
-
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
213
|
-
*/
|
|
214
|
-
|
|
215
|
-
function model(_x, _x2, _x3, _x4) {
|
|
216
|
-
return _model.apply(this, arguments);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function _model() {
|
|
220
|
-
_model = _asyncToGenerator(function* (question, session, env, updateSession) {
|
|
221
|
-
var normalizedQuestion = normalize(question);
|
|
222
|
-
var partA = parsePart(normalizedQuestion.partA, 'partA', session, env);
|
|
223
|
-
var partB = parsePart(normalizedQuestion.partB, 'partB', session, env);
|
|
224
|
-
var shuffledValues = {};
|
|
225
|
-
|
|
226
|
-
var us = part => (id, element, update) => new Promise(resolve => {
|
|
227
|
-
shuffledValues[part] = update.shuffledValues;
|
|
228
|
-
resolve();
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
var partASession = get(session, 'value.partA');
|
|
232
|
-
var partALockChoiceOrder = lockChoices(normalizedQuestion.partA, partASession, env);
|
|
233
|
-
var {
|
|
234
|
-
choices: partAChoices
|
|
235
|
-
} = partA || {};
|
|
236
|
-
var {
|
|
237
|
-
choices: partBChoices
|
|
238
|
-
} = partB || {};
|
|
239
|
-
|
|
240
|
-
if (!partALockChoiceOrder && partAChoices && partAChoices.length) {
|
|
241
|
-
partA.choices = yield getShuffledChoices(partAChoices, {
|
|
242
|
-
shuffledValues: (session.shuffledValues || {}).partA
|
|
243
|
-
}, us('partA'), 'value');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
var partBSession = get(session, 'value.partB');
|
|
247
|
-
var partBLockChoiceOrder = lockChoices(normalizedQuestion.partB, partBSession, env);
|
|
248
|
-
|
|
249
|
-
if (!partBLockChoiceOrder && partBChoices && partBChoices.length) {
|
|
250
|
-
partB.choices = yield getShuffledChoices(partBChoices, {
|
|
251
|
-
shuffledValues: (session.shuffledValues || {}).partB
|
|
252
|
-
}, us('partB'), 'value');
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (!isEmpty(shuffledValues)) {
|
|
256
|
-
if (updateSession && typeof updateSession === 'function') {
|
|
257
|
-
updateSession(session.id, session.element, {
|
|
258
|
-
shuffledValues
|
|
259
|
-
}).catch(e => {
|
|
260
|
-
// eslint-disable-next-line no-console
|
|
261
|
-
console.error('update session failed', e);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (normalizedQuestion.partLabels) {
|
|
267
|
-
var language = normalizedQuestion.language;
|
|
268
|
-
partA.partLabel = translator.t('ebsr.part', {
|
|
269
|
-
lng: language,
|
|
270
|
-
index: normalizedQuestion.partLabelType === 'Letters' ? 'A' : '1'
|
|
271
|
-
});
|
|
272
|
-
partB.partLabel = translator.t('ebsr.part', {
|
|
273
|
-
lng: language,
|
|
274
|
-
index: normalizedQuestion.partLabelType === 'Letters' ? 'B' : '2'
|
|
275
|
-
});
|
|
276
|
-
} else {
|
|
277
|
-
partA.partLabel = undefined;
|
|
278
|
-
partB.partLabel = undefined;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
282
|
-
partA.teacherInstructions = normalizedQuestion.partA.teacherInstructionsEnabled ? normalizedQuestion.partA.teacherInstructions : null;
|
|
283
|
-
partB.teacherInstructions = normalizedQuestion.partB.teacherInstructionsEnabled ? normalizedQuestion.partB.teacherInstructions : null;
|
|
284
|
-
} else {
|
|
285
|
-
partA.teacherInstructions = null;
|
|
286
|
-
partB.teacherInstructions = null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
partA.prompt = normalizedQuestion.partA.promptEnabled ? normalizedQuestion.partA.prompt : null;
|
|
290
|
-
partB.prompt = normalizedQuestion.partB.promptEnabled ? normalizedQuestion.partB.prompt : null;
|
|
291
|
-
return new Promise(resolve => {
|
|
292
|
-
resolve({
|
|
293
|
-
disabled: env.mode !== 'gather',
|
|
294
|
-
mode: env.mode,
|
|
295
|
-
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
296
|
-
partA,
|
|
297
|
-
partB
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
return _model.apply(this, arguments);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
var createDefaultModel = function createDefaultModel() {
|
|
305
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
306
|
-
return new Promise(resolve => {
|
|
307
|
-
resolve(_objectSpread(_objectSpread({}, defaults), model));
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
var isCorrect = c => c.correct === true;
|
|
312
|
-
|
|
313
|
-
var getScore = (config, sessionPart, key, partialScoringEnabled) => {
|
|
314
|
-
var {
|
|
315
|
-
choices = []
|
|
316
|
-
} = config && config[key] || {};
|
|
317
|
-
var maxScore = choices.length;
|
|
318
|
-
var {
|
|
319
|
-
value: sessionPartValue
|
|
320
|
-
} = sessionPart || {};
|
|
321
|
-
|
|
322
|
-
var chosen = c => !!(sessionPartValue || []).find(v => v === c.value);
|
|
323
|
-
|
|
324
|
-
var correctAndNotChosen = c => isCorrect(c) && !chosen(c);
|
|
325
|
-
|
|
326
|
-
var incorrectAndChosen = c => !isCorrect(c) && chosen(c);
|
|
327
|
-
|
|
328
|
-
var correctChoices = choices.reduce((total, choice) => {
|
|
329
|
-
if (correctAndNotChosen(choice) || incorrectAndChosen(choice)) {
|
|
330
|
-
return total - 1;
|
|
331
|
-
} else {
|
|
332
|
-
return total;
|
|
333
|
-
}
|
|
334
|
-
}, choices.length); // determine score for a part
|
|
335
|
-
|
|
336
|
-
if (!partialScoringEnabled && correctChoices < maxScore) {
|
|
337
|
-
return 0;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return parseFloat(maxScore ? (correctChoices / maxScore).toFixed(2) : 0);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
function outcome(config, session, env) {
|
|
344
|
-
return new Promise(resolve => {
|
|
345
|
-
var {
|
|
346
|
-
value
|
|
347
|
-
} = session || {};
|
|
348
|
-
|
|
349
|
-
if (!session || !value) {
|
|
350
|
-
resolve({
|
|
351
|
-
score: 0,
|
|
352
|
-
scoreA: 0,
|
|
353
|
-
scoreB: 0,
|
|
354
|
-
empty: true
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (value) {
|
|
359
|
-
var {
|
|
360
|
-
partA,
|
|
361
|
-
partB
|
|
362
|
-
} = value || {};
|
|
363
|
-
var partialScoringEnabled = partialScoring.enabled(config, env);
|
|
364
|
-
var scoreA = getScore(config, partA, 'partA', partialScoringEnabled);
|
|
365
|
-
var scoreB = getScore(config, partB, 'partB', partialScoringEnabled);
|
|
366
|
-
|
|
367
|
-
if (!partialScoringEnabled) {
|
|
368
|
-
// The EBSR item is worth 1 point
|
|
369
|
-
// That point is awarded if and only if both parts are fully correct, otherwise no points are awarded
|
|
370
|
-
resolve({
|
|
371
|
-
score: scoreA === 1 && scoreB === 1 ? 1 : 0,
|
|
372
|
-
scoreA,
|
|
373
|
-
scoreB,
|
|
374
|
-
max: 1
|
|
375
|
-
});
|
|
376
|
-
} else {
|
|
377
|
-
// The EBSR item is worth 2 points
|
|
378
|
-
if (scoreA === 1) {
|
|
379
|
-
if (scoreB === 1) {
|
|
380
|
-
// If Part A and Part B are both correct, 2 points are awarded
|
|
381
|
-
resolve({
|
|
382
|
-
score: 2,
|
|
383
|
-
scoreA,
|
|
384
|
-
scoreB,
|
|
385
|
-
max: 2
|
|
386
|
-
});
|
|
387
|
-
} else {
|
|
388
|
-
// If Part A is correct and part B is incorrect, 1 point is awarded
|
|
389
|
-
resolve({
|
|
390
|
-
score: 1,
|
|
391
|
-
scoreA,
|
|
392
|
-
scoreB,
|
|
393
|
-
max: 2
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
} else {
|
|
397
|
-
// For all other combinations, no points are awarded
|
|
398
|
-
resolve({
|
|
399
|
-
score: 0,
|
|
400
|
-
scoreA,
|
|
401
|
-
scoreB,
|
|
402
|
-
max: 2
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
var returnPartCorrect = choices => {
|
|
411
|
-
var answers = [];
|
|
412
|
-
choices.forEach(i => {
|
|
413
|
-
var {
|
|
414
|
-
correct,
|
|
415
|
-
value
|
|
416
|
-
} = i;
|
|
417
|
-
|
|
418
|
-
if (correct) {
|
|
419
|
-
answers.push(value);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
return answers;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
var createCorrectResponseSession = (question, env) => {
|
|
426
|
-
return new Promise(resolve => {
|
|
427
|
-
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
428
|
-
var {
|
|
429
|
-
partA,
|
|
430
|
-
partB
|
|
431
|
-
} = question;
|
|
432
|
-
var partACorrect = returnPartCorrect(partA.choices);
|
|
433
|
-
var partBCorrect = returnPartCorrect(partB.choices);
|
|
434
|
-
resolve({
|
|
435
|
-
value: {
|
|
436
|
-
partA: {
|
|
437
|
-
id: 'partA',
|
|
438
|
-
value: partACorrect
|
|
439
|
-
},
|
|
440
|
-
partB: {
|
|
441
|
-
id: 'partB',
|
|
442
|
-
value: partBCorrect
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
id: '1'
|
|
446
|
-
});
|
|
447
|
-
} else {
|
|
448
|
-
resolve(null);
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
}; // remove all html tags
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
var getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
455
|
-
|
|
456
|
-
var validatePart = function validatePart() {
|
|
457
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
458
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
459
|
-
var {
|
|
460
|
-
choices
|
|
461
|
-
} = model;
|
|
462
|
-
var {
|
|
463
|
-
minAnswerChoices = 2,
|
|
464
|
-
maxAnswerChoices
|
|
465
|
-
} = config;
|
|
466
|
-
var reversedChoices = [...(choices || [])].reverse();
|
|
467
|
-
var errors = {};
|
|
468
|
-
var choicesErrors = {};
|
|
469
|
-
var rationaleErrors = {};
|
|
470
|
-
var hasCorrectResponse = false;
|
|
471
|
-
['teacherInstructions', 'prompt'].forEach(field => {
|
|
472
|
-
var _config$field;
|
|
473
|
-
|
|
474
|
-
if ((_config$field = config[field]) !== null && _config$field !== void 0 && _config$field.required && !getContent(model[field])) {
|
|
475
|
-
errors[field] = 'This field is required.';
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
reversedChoices.forEach((choice, index) => {
|
|
479
|
-
var _config$rationale;
|
|
480
|
-
|
|
481
|
-
var {
|
|
482
|
-
correct,
|
|
483
|
-
value,
|
|
484
|
-
label,
|
|
485
|
-
rationale
|
|
486
|
-
} = choice;
|
|
487
|
-
|
|
488
|
-
if (correct) {
|
|
489
|
-
hasCorrectResponse = true;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (!getContent(label)) {
|
|
493
|
-
choicesErrors[value] = 'Content should not be empty.';
|
|
494
|
-
} else {
|
|
495
|
-
var identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);
|
|
496
|
-
|
|
497
|
-
if (identicalAnswer) {
|
|
498
|
-
choicesErrors[value] = 'Content should be unique.';
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if ((_config$rationale = config.rationale) !== null && _config$rationale !== void 0 && _config$rationale.required && !getContent(rationale)) {
|
|
503
|
-
rationaleErrors[value] = 'This field is required.';
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
var nbOfChoices = (choices || []).length;
|
|
507
|
-
|
|
508
|
-
if (nbOfChoices < minAnswerChoices) {
|
|
509
|
-
errors.answerChoices = "There should be at least ".concat(minAnswerChoices, " choices defined.");
|
|
510
|
-
} else if (nbOfChoices > maxAnswerChoices) {
|
|
511
|
-
errors.answerChoices = "No more than ".concat(maxAnswerChoices, " choices should be defined.");
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
if (!hasCorrectResponse) {
|
|
515
|
-
errors.correctResponse = 'No correct response defined.';
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
if (!isEmpty(choicesErrors)) {
|
|
519
|
-
errors.choices = choicesErrors;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (!isEmpty(rationaleErrors)) {
|
|
523
|
-
errors.rationale = rationaleErrors;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
return errors;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
var validate = function validate() {
|
|
530
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
531
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
532
|
-
var {
|
|
533
|
-
partA,
|
|
534
|
-
partB
|
|
535
|
-
} = model || {};
|
|
536
|
-
var {
|
|
537
|
-
partA: partAConfig,
|
|
538
|
-
partB: partBConfig
|
|
539
|
-
} = config || {};
|
|
540
|
-
var partAErrors = validatePart(partA, partAConfig);
|
|
541
|
-
var partBErrors = validatePart(partB, partBConfig);
|
|
542
|
-
return {
|
|
543
|
-
partA: partAErrors,
|
|
544
|
-
partB: partBErrors
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
export { createCorrectResponseSession, createDefaultModel, model, normalize, outcome, validate };
|
|
549
|
-
//# sourceMappingURL=controller.js.map
|
package/esm/controller.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../controller/src/defaults.js","../controller/src/utils.js","../controller/src/index.js"],"sourcesContent":["function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","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","import isEqual from 'lodash/isEqual';\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","import defaults from './defaults';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport { isResponseCorrect } from './utils';\nimport get from 'lodash/get';\nimport isEmpty from 'lodash/isEmpty';\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\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 });\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\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 });\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 });\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 });\n }\n } else {\n // For all other combinations, no points are awarded\n resolve({ score: 0, scoreA, scoreB, max: 2 });\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"],"names":["objectWithoutPropertiesLoose","partModel","base","_objectSpread","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","prompt","promptEnabled","rationale","rationaleEnabled","spellCheckEnabled","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","partLabels","partLabelType","partA","partB","getCorrectResponse","filter","c","correct","map","value","sort","isResponseCorrect","question","key","session","correctResponse","isEqual","translator","Translator","prepareChoice","model","env","defaultFeedback","choice","out","label","role","mode","feedbackType","feedback","type","parsePart","part","Object","assign","incorrect","disabled","complete","min","length","responseCorrect","undefined","normalizePart","verticalMode","normalize","language","defaults","updateSession","normalizedQuestion","shuffledValues","us","id","element","update","Promise","resolve","partASession","get","partALockChoiceOrder","lockChoices","partAChoices","partBChoices","getShuffledChoices","partBSession","partBLockChoiceOrder","isEmpty","catch","e","console","error","partLabel","t","lng","index","extraCSSRules","createDefaultModel","isCorrect","getScore","config","sessionPart","partialScoringEnabled","maxScore","sessionPartValue","chosen","find","v","correctAndNotChosen","incorrectAndChosen","correctChoices","reduce","total","parseFloat","toFixed","outcome","score","scoreA","scoreB","empty","partialScoring","enabled","max","returnPartCorrect","answers","forEach","i","push","createCorrectResponseSession","partACorrect","partBCorrect","getContent","html","replace","validatePart","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","errors","choicesErrors","rationaleErrors","hasCorrectResponse","field","required","identicalAnswer","slice","some","nbOfChoices","answerChoices","validate","partAConfig","partBConfig","partAErrors","partBErrors"],"mappings":";;;;;;AAAA,SAAS,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,M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