@pie-element/match-list 7.1.1 → 7.1.2-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controller.js +1 -0
- package/dist/browser/controller/index.js +201 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +13055 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-BT3FUErB.js +274 -0
- package/dist/browser/dist-BT3FUErB.js.map +1 -0
- package/dist/controller/defaults.d.ts +17 -0
- package/dist/controller/defaults.js +9 -0
- package/dist/controller/index.d.ts +38 -0
- package/dist/controller/index.js +105 -0
- package/dist/delivery/answer-area.d.ts +27 -0
- package/dist/delivery/answer-area.js +92 -0
- package/dist/delivery/answer.d.ts +40 -0
- package/dist/delivery/answer.js +176 -0
- package/dist/delivery/arrow.d.ts +17 -0
- package/dist/delivery/arrow.js +35 -0
- package/dist/delivery/choices-list.d.ts +21 -0
- package/dist/delivery/choices-list.js +35 -0
- package/dist/delivery/droppable-placeholder.d.ts +24 -0
- package/dist/delivery/droppable-placeholder.js +42 -0
- package/dist/delivery/index.d.ts +21 -0
- package/dist/delivery/index.js +49 -0
- package/dist/delivery/main.d.ts +26 -0
- package/dist/delivery/main.js +147 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +70 -22
- package/CHANGELOG.json +0 -572
- package/CHANGELOG.md +0 -1489
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/controller/CHANGELOG.json +0 -242
- package/controller/CHANGELOG.md +0 -1047
- package/controller/lib/defaults.js +0 -15
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -246
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -25
- package/docs/config-schema.json +0 -70
- package/docs/config-schema.json.md +0 -55
- package/docs/demo/config.js +0 -34
- package/docs/demo/generate.js +0 -54
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -170
- package/docs/pie-schema.json.md +0 -104
- package/lib/answer-area.js +0 -168
- package/lib/answer-area.js.map +0 -1
- package/lib/answer.js +0 -267
- package/lib/answer.js.map +0 -1
- package/lib/arrow.js +0 -57
- package/lib/arrow.js.map +0 -1
- package/lib/choices-list.js +0 -60
- package/lib/choices-list.js.map +0 -1
- package/lib/droppable-placeholder.js +0 -60
- package/lib/droppable-placeholder.js.map +0 -1
- package/lib/index.js +0 -86
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -220
- package/lib/main.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = {
|
|
8
|
-
config: {
|
|
9
|
-
answers: [],
|
|
10
|
-
prompt: '',
|
|
11
|
-
prompts: [],
|
|
12
|
-
shuffled: false
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["config","answers","prompt","prompts","shuffled"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n config: {\n answers: [],\n prompt: '',\n prompts: [],\n shuffled: false,\n },\n};\n"],"mappings":";;;;;;iCAAe;EACbA,MAAM,EAAE;IACNC,OAAO,EAAE,EAAE;IACXC,MAAM,EAAE,EAAE;IACVC,OAAO,EAAE,EAAE;IACXC,QAAQ,EAAE;EACZ;AACF,CAAC","ignoreList":[]}
|
package/controller/lib/index.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createCorrectResponseSession = void 0;
|
|
8
|
-
exports.createDefaultModel = createDefaultModel;
|
|
9
|
-
exports.getLogTrace = void 0;
|
|
10
|
-
exports.model = model;
|
|
11
|
-
exports.outcome = exports.normalize = void 0;
|
|
12
|
-
var _lodashEs = require("lodash-es");
|
|
13
|
-
var _feedback = require("@pie-lib/feedback");
|
|
14
|
-
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
15
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
16
|
-
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
17
|
-
const log = (0, _debug.default)('@pie-element:match-list:controller');
|
|
18
|
-
const getResponseCorrectness = (model, answers, env) => {
|
|
19
|
-
const isPartialScoring = _controllerUtils.partialScoring.enabled(model, env);
|
|
20
|
-
const prompts = model.prompts;
|
|
21
|
-
if (!answers || Object.keys(answers).length === 0) {
|
|
22
|
-
return 'unanswered';
|
|
23
|
-
}
|
|
24
|
-
const totalCorrectAnswers = getTotalCorrect(model);
|
|
25
|
-
const correctAnswers = getCorrectSelected(prompts, answers);
|
|
26
|
-
if (totalCorrectAnswers === correctAnswers) {
|
|
27
|
-
return 'correct';
|
|
28
|
-
} else if (correctAnswers === 0) {
|
|
29
|
-
return 'incorrect';
|
|
30
|
-
} else if (isPartialScoring) {
|
|
31
|
-
return 'partial';
|
|
32
|
-
}
|
|
33
|
-
return 'incorrect';
|
|
34
|
-
};
|
|
35
|
-
const getCorrectness = (question, env, answers) => {
|
|
36
|
-
if (env.mode === 'evaluate') {
|
|
37
|
-
return getResponseCorrectness(question, answers, env);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const getCorrectSelected = (prompts = [], answers) => {
|
|
41
|
-
let correctAnswers = 0;
|
|
42
|
-
prompts.forEach(p => {
|
|
43
|
-
if (p.relatedAnswer === answers[p.id]) {
|
|
44
|
-
correctAnswers += 1;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return correctAnswers;
|
|
48
|
-
};
|
|
49
|
-
const getTotalCorrect = question => {
|
|
50
|
-
return question && question.prompts ? question.prompts.length : 0;
|
|
51
|
-
};
|
|
52
|
-
const getPartialScore = (question, answers) => {
|
|
53
|
-
const count = getCorrectSelected(question && question.prompts, answers);
|
|
54
|
-
const totalCorrect = getTotalCorrect(question);
|
|
55
|
-
return parseFloat((count / totalCorrect).toFixed(2));
|
|
56
|
-
};
|
|
57
|
-
const getOutComeScore = (question, env, answers) => {
|
|
58
|
-
const correctness = getCorrectness(question, env, answers);
|
|
59
|
-
return correctness === 'correct' ? 1 : correctness === 'partial' && true ? getPartialScore(question, answers) : 0;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Generates detailed trace log for match-list scoring evaluation
|
|
64
|
-
* @param {Object} question
|
|
65
|
-
* @param {Object} session
|
|
66
|
-
* @param {Object} env
|
|
67
|
-
* @returns {Array<string>} traceLog
|
|
68
|
-
*/
|
|
69
|
-
const getLogTrace = (question, session, env) => {
|
|
70
|
-
const traceLog = [];
|
|
71
|
-
const prompts = question?.prompts || [];
|
|
72
|
-
const answers = session?.value || {};
|
|
73
|
-
if (!answers || Object.keys(answers).length === 0) {
|
|
74
|
-
traceLog.push('Student did not provide any answer.');
|
|
75
|
-
return traceLog;
|
|
76
|
-
}
|
|
77
|
-
const totalPrompts = prompts.length;
|
|
78
|
-
traceLog.push(`Match-list item contains ${totalPrompts} question(s).`);
|
|
79
|
-
let correctCount = 0;
|
|
80
|
-
let answeredCount = 0;
|
|
81
|
-
prompts.forEach(prompt => {
|
|
82
|
-
const expectedAnswer = prompt.relatedAnswer;
|
|
83
|
-
const studentAnswer = answers[prompt.id];
|
|
84
|
-
if (studentAnswer !== undefined) {
|
|
85
|
-
answeredCount += 1;
|
|
86
|
-
if (studentAnswer === expectedAnswer) {
|
|
87
|
-
correctCount += 1;
|
|
88
|
-
traceLog.push(`Question ${prompt.id}: correctly matched.`);
|
|
89
|
-
} else {
|
|
90
|
-
traceLog.push(`Question ${prompt.id}: incorrectly matched (selected '${studentAnswer}', expected '${expectedAnswer}').`);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
traceLog.push(`Question ${prompt.id}: no answer provided.`);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
traceLog.push(`Student correctly matched ${correctCount} out of ${totalPrompts} question(s).`);
|
|
97
|
-
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(question, env);
|
|
98
|
-
if (partialScoringEnabled) {
|
|
99
|
-
traceLog.push('Score calculated using partial scoring.');
|
|
100
|
-
traceLog.push('Score is the number of correct matches divided by the total number of questions.');
|
|
101
|
-
} else {
|
|
102
|
-
traceLog.push('Score calculated using all-or-nothing scoring.');
|
|
103
|
-
traceLog.push('Student must match all questions correctly to receive full credit.');
|
|
104
|
-
}
|
|
105
|
-
const rawScore = getOutComeScore(question, env, answers);
|
|
106
|
-
const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;
|
|
107
|
-
traceLog.push(`Final score: ${finalScore}.`);
|
|
108
|
-
return traceLog;
|
|
109
|
-
};
|
|
110
|
-
exports.getLogTrace = getLogTrace;
|
|
111
|
-
const outcome = (question, session, env) => {
|
|
112
|
-
return new Promise(resolve => {
|
|
113
|
-
if (env.mode !== 'evaluate') {
|
|
114
|
-
resolve({
|
|
115
|
-
score: undefined,
|
|
116
|
-
completed: undefined,
|
|
117
|
-
logTrace: []
|
|
118
|
-
});
|
|
119
|
-
} else {
|
|
120
|
-
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
121
|
-
resolve({
|
|
122
|
-
score: 0,
|
|
123
|
-
empty: true,
|
|
124
|
-
logTrace: ['Student did not provide any answer.']
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
const out = {
|
|
128
|
-
score: getOutComeScore(question, env, session.value),
|
|
129
|
-
empty: false,
|
|
130
|
-
logTrace: getLogTrace(question, session, env)
|
|
131
|
-
};
|
|
132
|
-
resolve(out);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
exports.outcome = outcome;
|
|
138
|
-
function createDefaultModel(model = {}) {
|
|
139
|
-
return new Promise(resolve => {
|
|
140
|
-
resolve({
|
|
141
|
-
..._defaults.default,
|
|
142
|
-
...model
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const normalize = model => ({
|
|
147
|
-
..._defaults.default,
|
|
148
|
-
...model
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
* @param {*} question
|
|
154
|
-
* @param {*} session
|
|
155
|
-
* @param {*} env
|
|
156
|
-
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
157
|
-
*/
|
|
158
|
-
exports.normalize = normalize;
|
|
159
|
-
async function model(question, session, env, updateSession) {
|
|
160
|
-
question = normalize(question);
|
|
161
|
-
const correctness = getCorrectness(question, env, session && session.value);
|
|
162
|
-
const correctResponse = {};
|
|
163
|
-
const score = `${getOutComeScore(question, env, session && session.value) * 100}%`;
|
|
164
|
-
const correctInfo = {
|
|
165
|
-
score,
|
|
166
|
-
correctness
|
|
167
|
-
};
|
|
168
|
-
const shuffledValues = {};
|
|
169
|
-
let prompts = question.prompts;
|
|
170
|
-
let answers = question.answers;
|
|
171
|
-
const us = part => (id, element, update) => {
|
|
172
|
-
return new Promise(resolve => {
|
|
173
|
-
shuffledValues[part] = update.shuffledValues;
|
|
174
|
-
resolve();
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
const lockChoiceOrder = (0, _controllerUtils.lockChoices)(question, session, env);
|
|
178
|
-
if (!lockChoiceOrder) {
|
|
179
|
-
prompts = await (0, _controllerUtils.getShuffledChoices)(prompts, {
|
|
180
|
-
shuffledValues: (session && session.shuffledValues || {}).prompts
|
|
181
|
-
}, us('prompts'), 'id');
|
|
182
|
-
answers = await (0, _controllerUtils.getShuffledChoices)(answers, {
|
|
183
|
-
shuffledValues: (session && session.shuffledValues || {}).answers
|
|
184
|
-
}, us('answers'), 'id');
|
|
185
|
-
}
|
|
186
|
-
if (!(0, _lodashEs.isEmpty)(shuffledValues)) {
|
|
187
|
-
if (updateSession && typeof updateSession === 'function') {
|
|
188
|
-
updateSession(session.id, session.element, {
|
|
189
|
-
shuffledValues
|
|
190
|
-
}).catch(e => {
|
|
191
|
-
// eslint-disable-next-line no-console
|
|
192
|
-
console.error('update session failed', e);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (question && prompts) {
|
|
197
|
-
prompts.forEach(prompt => {
|
|
198
|
-
correctResponse[prompt.id] = prompt.relatedAnswer;
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const feedback = env.mode === 'evaluate' ? await (0, _feedback.getFeedbackForCorrectness)(correctInfo.correctness, question.feedback) : undefined;
|
|
202
|
-
const base = {
|
|
203
|
-
config: {
|
|
204
|
-
...question,
|
|
205
|
-
prompts,
|
|
206
|
-
answers
|
|
207
|
-
},
|
|
208
|
-
correctness: correctInfo,
|
|
209
|
-
feedback,
|
|
210
|
-
mode: env.mode
|
|
211
|
-
};
|
|
212
|
-
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
213
|
-
base.rationale = question.rationale;
|
|
214
|
-
} else {
|
|
215
|
-
base.rationale = null;
|
|
216
|
-
}
|
|
217
|
-
const out = Object.assign(base, {
|
|
218
|
-
correctResponse
|
|
219
|
-
});
|
|
220
|
-
log('out: ', out);
|
|
221
|
-
return out;
|
|
222
|
-
}
|
|
223
|
-
const createCorrectResponseSession = (question, env) => {
|
|
224
|
-
return new Promise(resolve => {
|
|
225
|
-
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
226
|
-
const {
|
|
227
|
-
prompts,
|
|
228
|
-
answers
|
|
229
|
-
} = question;
|
|
230
|
-
const value = {};
|
|
231
|
-
prompts.forEach(p => {
|
|
232
|
-
if (answers.filter(a => a.id === p.relatedAnswer).length) {
|
|
233
|
-
value[p.id] = p.relatedAnswer;
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
resolve({
|
|
237
|
-
value,
|
|
238
|
-
id: '1'
|
|
239
|
-
});
|
|
240
|
-
} else {
|
|
241
|
-
resolve(null);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
246
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_lodashEs","require","_feedback","_controllerUtils","_debug","_interopRequireDefault","_defaults","log","debug","getResponseCorrectness","model","answers","env","isPartialScoring","partialScoring","enabled","prompts","Object","keys","length","totalCorrectAnswers","getTotalCorrect","correctAnswers","getCorrectSelected","getCorrectness","question","mode","forEach","p","relatedAnswer","id","getPartialScore","count","totalCorrect","parseFloat","toFixed","getOutComeScore","correctness","getLogTrace","session","traceLog","value","push","totalPrompts","correctCount","answeredCount","prompt","expectedAnswer","studentAnswer","undefined","partialScoringEnabled","rawScore","finalScore","exports","outcome","Promise","resolve","score","completed","logTrace","isEmpty","empty","out","createDefaultModel","defaults","normalize","updateSession","correctResponse","correctInfo","shuffledValues","us","part","element","update","lockChoiceOrder","lockChoices","getShuffledChoices","catch","e","console","error","feedback","getFeedbackForCorrectness","base","config","role","rationale","assign","createCorrectResponseSession","filter","a"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport debug from 'debug';\n\nconst log = debug('@pie-element:match-list:controller');\n\nimport defaults from './defaults';\n\nconst getResponseCorrectness = (model, answers, env) => {\n const isPartialScoring = partialScoring.enabled(model, env);\n const prompts = model.prompts;\n\n if (!answers || Object.keys(answers).length === 0) {\n return 'unanswered';\n }\n\n const totalCorrectAnswers = getTotalCorrect(model);\n const correctAnswers = getCorrectSelected(prompts, answers);\n\n if (totalCorrectAnswers === correctAnswers) {\n return 'correct';\n } else if (correctAnswers === 0) {\n return 'incorrect';\n } else if (isPartialScoring) {\n return 'partial';\n }\n\n return 'incorrect';\n};\n\nconst getCorrectness = (question, env, answers) => {\n if (env.mode === 'evaluate') {\n return getResponseCorrectness(question, answers, env);\n }\n};\n\nconst getCorrectSelected = (prompts = [], answers) => {\n let correctAnswers = 0;\n\n prompts.forEach((p) => {\n if (p.relatedAnswer === answers[p.id]) {\n correctAnswers += 1;\n }\n });\n\n return correctAnswers;\n};\n\nconst getTotalCorrect = (question) => {\n return question && question.prompts ? question.prompts.length : 0;\n};\n\nconst getPartialScore = (question, answers) => {\n const count = getCorrectSelected(question && question.prompts, answers);\n const totalCorrect = getTotalCorrect(question);\n\n return parseFloat((count / totalCorrect).toFixed(2));\n};\n\nconst getOutComeScore = (question, env, answers) => {\n const correctness = getCorrectness(question, env, answers);\n\n return correctness === 'correct' ? 1 : correctness === 'partial' && true ? getPartialScore(question, answers) : 0;\n};\n\n/**\n * Generates detailed trace log for match-list 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 const prompts = question?.prompts || [];\n const answers = session?.value || {};\n\n if (!answers || Object.keys(answers).length === 0) {\n traceLog.push('Student did not provide any answer.');\n return traceLog;\n }\n\n const totalPrompts = prompts.length;\n traceLog.push(`Match-list item contains ${totalPrompts} question(s).`);\n\n let correctCount = 0;\n let answeredCount = 0;\n\n prompts.forEach((prompt) => {\n const expectedAnswer = prompt.relatedAnswer;\n const studentAnswer = answers[prompt.id];\n\n if (studentAnswer !== undefined) {\n answeredCount += 1;\n\n if (studentAnswer === expectedAnswer) {\n correctCount += 1;\n traceLog.push(`Question ${prompt.id}: correctly matched.`);\n } else {\n traceLog.push(\n `Question ${prompt.id}: incorrectly matched (selected '${studentAnswer}', expected '${expectedAnswer}').`,\n );\n }\n } else {\n traceLog.push(`Question ${prompt.id}: no answer provided.`);\n }\n });\n\n traceLog.push(\n `Student correctly matched ${correctCount} out of ${totalPrompts} question(s).`,\n );\n\n const partialScoringEnabled = partialScoring.enabled(question, env);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push(\n 'Score is the number of correct matches divided by the total number of questions.',\n );\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push(\n 'Student must match all questions correctly to receive full credit.',\n );\n }\n\n const rawScore = getOutComeScore(question, env, answers);\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport const outcome = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined, logTrace: [] });\n } else {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not provide any answer.'] });\n } else {\n const out = {\n score: getOutComeScore(question, env, session.value),\n empty: false,\n logTrace: getLogTrace(question, session, env),\n };\n\n resolve(out);\n }\n }\n });\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n}\n\nexport const normalize = (model) => ({ ...defaults, ...model });\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 question = normalize(question);\n const correctness = getCorrectness(question, env, session && session.value);\n const correctResponse = {};\n const score = `${getOutComeScore(question, env, session && session.value) * 100}%`;\n const correctInfo = {\n score,\n correctness,\n };\n\n const shuffledValues = {};\n let prompts = question.prompts;\n let answers = question.answers;\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n const lockChoiceOrder = lockChoices(question, session, env);\n\n if (!lockChoiceOrder) {\n prompts = await getShuffledChoices(\n prompts,\n { shuffledValues: ((session && session.shuffledValues) || {}).prompts },\n us('prompts'),\n 'id',\n );\n answers = await getShuffledChoices(\n answers,\n { shuffledValues: ((session && session.shuffledValues) || {}).answers },\n us('answers'),\n 'id',\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 (question && prompts) {\n prompts.forEach((prompt) => {\n correctResponse[prompt.id] = prompt.relatedAnswer;\n });\n }\n\n const feedback =\n env.mode === 'evaluate'\n ? await getFeedbackForCorrectness(correctInfo.correctness, question.feedback)\n : undefined;\n\n const base = {\n config: {\n ...question,\n prompts,\n answers,\n },\n correctness: correctInfo,\n feedback,\n mode: env.mode,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = question.rationale;\n } else {\n base.rationale = null;\n }\n\n const out = Object.assign(base, {\n correctResponse,\n });\n\n log('out: ', out);\n return out;\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { prompts, answers } = question;\n const value = {};\n\n prompts.forEach((p) => {\n if (answers.filter((a) => a.id === p.relatedAnswer).length) {\n value[p.id] = p.relatedAnswer;\n }\n });\n\n resolve({\n value,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA,IAAAK,SAAA,GAAAD,sBAAA,CAAAJ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0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pie-element/match-list-controller",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "6.1.1",
|
|
5
|
-
"description": "",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"module": "src/index.js",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "./node_modules/.bin/jest"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@pie-lib/controller-utils": "2.0.2",
|
|
13
|
-
"@pie-lib/feedback": "2.0.2",
|
|
14
|
-
"debug": "^4.1.1",
|
|
15
|
-
"lodash-es": "^4.17.23"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"babel-jest": "^29.7.0",
|
|
19
|
-
"babel-preset-env": "^1.6.1",
|
|
20
|
-
"babel-preset-stage-0": "^6.24.1",
|
|
21
|
-
"jest": "^29.7.0"
|
|
22
|
-
},
|
|
23
|
-
"author": "",
|
|
24
|
-
"license": "ISC"
|
|
25
|
-
}
|
package/docs/config-schema.json
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Config Object for @pie-elements/match-list",
|
|
3
|
-
"additionalProperties": false,
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"showPrompt": {
|
|
7
|
-
"description": "Determines whether prompt field will be displayed or not",
|
|
8
|
-
"default": true,
|
|
9
|
-
"type": "boolean",
|
|
10
|
-
"title": "showPrompt"
|
|
11
|
-
},
|
|
12
|
-
"promptLabel": {
|
|
13
|
-
"description": "The label for the item stem/prompt field",
|
|
14
|
-
"default": "Item Stemm",
|
|
15
|
-
"type": "string",
|
|
16
|
-
"title": "promptLabel"
|
|
17
|
-
},
|
|
18
|
-
"contentDimensions": {
|
|
19
|
-
"description": "Indicates the dimensions configuration for the authoring container\nNote: Some items have a default minimum width because of their content, but if\nthe minWidth is lower than this, the overflow behavior will take care of that",
|
|
20
|
-
"default": ": {}",
|
|
21
|
-
"type": "object",
|
|
22
|
-
"properties": {
|
|
23
|
-
"maxHeight": {
|
|
24
|
-
"description": "Indicates the max height of the authoring container",
|
|
25
|
-
"default": "undefined",
|
|
26
|
-
"type": [
|
|
27
|
-
"string",
|
|
28
|
-
"number"
|
|
29
|
-
],
|
|
30
|
-
"title": "maxHeight"
|
|
31
|
-
},
|
|
32
|
-
"maxWidth": {
|
|
33
|
-
"description": "Indicates the max width of the authoring container",
|
|
34
|
-
"default": "undefined",
|
|
35
|
-
"type": [
|
|
36
|
-
"string",
|
|
37
|
-
"number"
|
|
38
|
-
],
|
|
39
|
-
"title": "maxWidth"
|
|
40
|
-
},
|
|
41
|
-
"minHeight": {
|
|
42
|
-
"description": "Indicates the min height of the authoring container",
|
|
43
|
-
"default": "undefined",
|
|
44
|
-
"type": [
|
|
45
|
-
"string",
|
|
46
|
-
"number"
|
|
47
|
-
],
|
|
48
|
-
"title": "minHeight"
|
|
49
|
-
},
|
|
50
|
-
"minWidth": {
|
|
51
|
-
"description": "Indicates the min width of the authoring container",
|
|
52
|
-
"default": "undefined",
|
|
53
|
-
"type": [
|
|
54
|
-
"string",
|
|
55
|
-
"number"
|
|
56
|
-
],
|
|
57
|
-
"title": "minWidth"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"title": "contentDimensions"
|
|
61
|
-
},
|
|
62
|
-
"settingsPartialScoring": {
|
|
63
|
-
"description": "Indicates whether the settings panel wil allow the author to modify settings for partial scoring",
|
|
64
|
-
"default": true,
|
|
65
|
-
"type": "boolean",
|
|
66
|
-
"title": "settingsPartialScoring"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
70
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
Config Object for @pie-elements/match-list
|
|
2
|
-
|
|
3
|
-
The schema defines the following properties:
|
|
4
|
-
|
|
5
|
-
# `showPrompt` (boolean)
|
|
6
|
-
|
|
7
|
-
Determines whether prompt field will be displayed or not
|
|
8
|
-
|
|
9
|
-
Default: `true`
|
|
10
|
-
|
|
11
|
-
# `promptLabel` (string)
|
|
12
|
-
|
|
13
|
-
The label for the item stem/prompt field
|
|
14
|
-
|
|
15
|
-
Default: `"Item Stemm"`
|
|
16
|
-
|
|
17
|
-
# `contentDimensions` (object)
|
|
18
|
-
|
|
19
|
-
Indicates the dimensions configuration for the authoring container
|
|
20
|
-
Note: Some items have a default minimum width because of their content, but if
|
|
21
|
-
the minWidth is lower than this, the overflow behavior will take care of that
|
|
22
|
-
|
|
23
|
-
Properties of the `contentDimensions` object:
|
|
24
|
-
|
|
25
|
-
## `maxHeight` (string,number)
|
|
26
|
-
|
|
27
|
-
Indicates the max height of the authoring container
|
|
28
|
-
|
|
29
|
-
Default: `"undefined"`
|
|
30
|
-
|
|
31
|
-
## `maxWidth` (string,number)
|
|
32
|
-
|
|
33
|
-
Indicates the max width of the authoring container
|
|
34
|
-
|
|
35
|
-
Default: `"undefined"`
|
|
36
|
-
|
|
37
|
-
## `minHeight` (string,number)
|
|
38
|
-
|
|
39
|
-
Indicates the min height of the authoring container
|
|
40
|
-
|
|
41
|
-
Default: `"undefined"`
|
|
42
|
-
|
|
43
|
-
## `minWidth` (string,number)
|
|
44
|
-
|
|
45
|
-
Indicates the min width of the authoring container
|
|
46
|
-
|
|
47
|
-
Default: `"undefined"`
|
|
48
|
-
|
|
49
|
-
Default: `": {}"`
|
|
50
|
-
|
|
51
|
-
# `settingsPartialScoring` (boolean)
|
|
52
|
-
|
|
53
|
-
Indicates whether the settings panel wil allow the author to modify settings for partial scoring
|
|
54
|
-
|
|
55
|
-
Default: `true`
|
package/docs/demo/config.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const { model } = require('./generate');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
elements: {
|
|
5
|
-
'match-list': '../..',
|
|
6
|
-
},
|
|
7
|
-
models: [model('1', 'match-list')],
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const prompt = (id, relatedAnswer) => ({
|
|
11
|
-
id,
|
|
12
|
-
title: `Prompt ${id}`,
|
|
13
|
-
relatedAnswer,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const answer = (id) => ({
|
|
17
|
-
id,
|
|
18
|
-
title: `Answer ${id}`,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const base = {
|
|
22
|
-
element: 'match-list',
|
|
23
|
-
config: {
|
|
24
|
-
prompt: 'Your prompt goes here',
|
|
25
|
-
prompts: [prompt(1, 1), prompt(3, 3), prompt(4, 4), prompt(2, 2)],
|
|
26
|
-
answers: [answer(1), answer(2), answer(3), answer(4), answer(5), answer(6)],
|
|
27
|
-
},
|
|
28
|
-
feedback: 'Incorrect',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const testModel = (id, extras) => Object.assign({}, base, { id, element: 'match-list' }, extras);
|
|
32
|
-
|
|
33
|
-
module.exports.model = testModel;
|
|
34
|
-
module.exports.answer = answer;
|
package/docs/demo/generate.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
exports.model = (id, element) => ({
|
|
2
|
-
id,
|
|
3
|
-
element,
|
|
4
|
-
lockChoiceOrder: true,
|
|
5
|
-
answers: [
|
|
6
|
-
{
|
|
7
|
-
id: 2,
|
|
8
|
-
title: 'Battle of Lexington and Concord'
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: 3,
|
|
12
|
-
title: 'Declaration of Independence'
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 1,
|
|
16
|
-
title: 'Boston Tea Party'
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: 0,
|
|
20
|
-
title: 'French and Indian War'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 4,
|
|
24
|
-
title: 'Constitutional Convention'
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
prompt: '<p>Match each year to the corresponding historical event. Drag and drop the events.</p>',
|
|
28
|
-
prompts: [ {
|
|
29
|
-
id: 1,
|
|
30
|
-
title: '1754',
|
|
31
|
-
relatedAnswer: 0
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 2,
|
|
35
|
-
title: '1773',
|
|
36
|
-
relatedAnswer: 1
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 3,
|
|
40
|
-
title: '1775',
|
|
41
|
-
relatedAnswer: 2
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 4,
|
|
45
|
-
title: '1776',
|
|
46
|
-
relatedAnswer: 3
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 5,
|
|
50
|
-
title: '1787',
|
|
51
|
-
relatedAnswer: 4
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
});
|
package/docs/demo/index.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<match-list pie-id="1"></match-list>
|