@digabi/exam-engine-mastering 16.1.3-alpha.0 → 16.2.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/dist/__tests__/testExamMastering.js +51 -36
- package/dist/__tests__/testExamMastering.js.map +1 -1
- package/dist/__tests__/testMexCreation.js +3 -3
- package/dist/__tests__/testMexCreation.js.map +1 -1
- package/dist/__tests__/testMigrations.js +14 -14
- package/dist/__tests__/testMigrations.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/createMex.js +8 -8
- package/dist/createMex.js.map +1 -1
- package/dist/getMediaMetadataFromLocalFile.js +1 -1
- package/dist/getMediaMetadataFromLocalFile.js.map +1 -1
- package/dist/mastering/createGradingStructure.js +11 -11
- package/dist/mastering/createGradingStructure.js.map +1 -1
- package/dist/mastering/index.d.ts.map +1 -1
- package/dist/mastering/index.js +58 -52
- package/dist/mastering/index.js.map +1 -1
- package/package.json +5 -5
- package/schema/exam.xsd +19 -3
- package/dist/mastering/createHvp.d.ts +0 -2
- package/dist/mastering/createHvp.d.ts.map +0 -1
- package/dist/mastering/createHvp.js +0 -100
- package/dist/mastering/createHvp.js.map +0 -1
package/schema/exam.xsd
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<xs:documentation>The exam language.</xs:documentation>
|
|
50
50
|
</xs:annotation>
|
|
51
51
|
</xs:attribute>
|
|
52
|
-
<xs:attribute name="exam-type" type="e:exam-type">
|
|
52
|
+
<xs:attribute name="exam-type" type="e:exam-type-list">
|
|
53
53
|
<xs:annotation>
|
|
54
54
|
<xs:documentation>
|
|
55
55
|
You may want to create separate versions of the exam for students with disabilities. If not
|
|
@@ -181,6 +181,15 @@
|
|
|
181
181
|
</xs:restriction>
|
|
182
182
|
</xs:simpleType>
|
|
183
183
|
|
|
184
|
+
<xs:simpleType name="exam-type-list">
|
|
185
|
+
<xs:restriction>
|
|
186
|
+
<xs:simpleType>
|
|
187
|
+
<xs:list itemType="e:exam-type" />
|
|
188
|
+
</xs:simpleType>
|
|
189
|
+
<xs:minLength value="1"/>
|
|
190
|
+
</xs:restriction>
|
|
191
|
+
</xs:simpleType>
|
|
192
|
+
|
|
184
193
|
<xs:element name="exam-versions">
|
|
185
194
|
<xs:complexType>
|
|
186
195
|
<xs:sequence>
|
|
@@ -450,11 +459,17 @@
|
|
|
450
459
|
<xs:element name="text-answer">
|
|
451
460
|
<xs:complexType>
|
|
452
461
|
<xs:sequence>
|
|
453
|
-
<xs:element name="hint" minOccurs="0" type="e:
|
|
462
|
+
<xs:element name="hint" minOccurs="0" type="e:LocalizableFlow" />
|
|
454
463
|
<xs:element name="answer-grading-instruction" minOccurs="0" type="e:Flow" />
|
|
455
464
|
</xs:sequence>
|
|
456
465
|
<xs:attribute name="type" type="e:text-answer-type" default="single-line" />
|
|
457
466
|
<xs:attribute name="max-score" type="xs:positiveInteger" use="required" />
|
|
467
|
+
<xs:attribute name="max-length" type="xs:positiveInteger" />
|
|
468
|
+
<xs:attribute name="use-language-of-instruction" type="xs:boolean" default="false">
|
|
469
|
+
<xs:annotation>
|
|
470
|
+
<xs:documentation>Whether the student should answer the question in the language of instruction (typically the mother tongue) instead of the subject language. This attribute controls the HTML lang attribute of the input element, so a screen reader will read the answer using the correct language. Used only in secondary language exams. </xs:documentation>
|
|
471
|
+
</xs:annotation>
|
|
472
|
+
</xs:attribute>
|
|
458
473
|
<xs:attributeGroup ref="e:stylable" />
|
|
459
474
|
</xs:complexType>
|
|
460
475
|
</xs:element>
|
|
@@ -493,13 +508,14 @@
|
|
|
493
508
|
<xs:element name="scored-text-answer">
|
|
494
509
|
<xs:complexType>
|
|
495
510
|
<xs:sequence>
|
|
496
|
-
<xs:element name="hint" minOccurs="0" type="e:
|
|
511
|
+
<xs:element name="hint" minOccurs="0" type="e:LocalizableFlow" />
|
|
497
512
|
<xs:element name="answer-grading-instruction" minOccurs="0" type="e:Flow" />
|
|
498
513
|
<xs:element ref="e:accepted-answer" minOccurs="0" maxOccurs="unbounded" />
|
|
499
514
|
</xs:sequence>
|
|
500
515
|
<xs:attribute name="type" type="e:text-answer-type" default="single-line" />
|
|
501
516
|
<xs:attribute name="max-score" type="xs:positiveInteger" />
|
|
502
517
|
<xs:attributeGroup ref="e:stylable" />
|
|
518
|
+
<xs:attributeGroup ref="e:localizable" />
|
|
503
519
|
</xs:complexType>
|
|
504
520
|
</xs:element>
|
|
505
521
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createHvp.d.ts","sourceRoot":"","sources":["../../src/mastering/createHvp.js"],"names":[],"mappings":"AAUO,+BAJI,OAAO,WAAW,EAAE,QAAQ,kBAC5B,MAAM,OAkGhB"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createHvp = void 0;
|
|
7
|
-
const ramda_1 = __importDefault(require("ramda"));
|
|
8
|
-
const schema_1 = require("./schema");
|
|
9
|
-
/**
|
|
10
|
-
* Generates HVP.
|
|
11
|
-
*
|
|
12
|
-
* @param {import("libxmljs2").Document} doc
|
|
13
|
-
* @param {string} targetLanguage
|
|
14
|
-
* @returns string
|
|
15
|
-
*/
|
|
16
|
-
const createHvp = (doc, targetLanguage) => {
|
|
17
|
-
const cleanString = (input) => input.trim().replace(/\s+/g, ' ');
|
|
18
|
-
const nodeContains = (elementName, node) => {
|
|
19
|
-
return node.find(`.//${elementName}`, schema_1.ns).length > 0;
|
|
20
|
-
};
|
|
21
|
-
const findQuestionTypes = (node) => {
|
|
22
|
-
const elementNamesToTypes = {
|
|
23
|
-
'fi-FI': {
|
|
24
|
-
'e:scored-text-answer': 'keskitetysti arvosteltava tekstivastaus',
|
|
25
|
-
'e:choice-answer': 'monivalintavastaus',
|
|
26
|
-
'e:dropdown-answer': 'monivalintavastaus',
|
|
27
|
-
'e:text-answer': 'tekstivastaus',
|
|
28
|
-
},
|
|
29
|
-
'sv-FI': {
|
|
30
|
-
'e:scored-text-answer': 'centraliserat bedömt textsvar',
|
|
31
|
-
'e:choice-answer': 'flervalssvar',
|
|
32
|
-
'e:dropdown-answer': 'flervalssvar',
|
|
33
|
-
'e:text-answer': 'textsvar',
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const elementNamesToTypesInTargetLanguage = elementNamesToTypes[targetLanguage];
|
|
37
|
-
return Object.keys(elementNamesToTypesInTargetLanguage)
|
|
38
|
-
.map((elementName) => (nodeContains(elementName, node) ? elementNamesToTypesInTargetLanguage[elementName] : null))
|
|
39
|
-
.filter((x) => x !== null);
|
|
40
|
-
};
|
|
41
|
-
const optionsWithScoresString = function (node, optionElementName) {
|
|
42
|
-
const prefix = optionElementName === 'e:choice-answer-option' ? '-' : ramda_1.default.last(getDisplayNumber(node).split('.')) + '.';
|
|
43
|
-
return node
|
|
44
|
-
.find(`.//${optionElementName}[@score]`, schema_1.ns)
|
|
45
|
-
.map((o) => `${prefix} ${cleanString(o.text())} (${o.attr('score').value()} p.)`)
|
|
46
|
-
.join('\n');
|
|
47
|
-
};
|
|
48
|
-
const getAttributeValue = (attributeName) => (node) => node.attr(attributeName).value();
|
|
49
|
-
const getMaxScore = getAttributeValue('max-score');
|
|
50
|
-
const getScore = getAttributeValue('score');
|
|
51
|
-
const getDisplayNumber = getAttributeValue('display-number');
|
|
52
|
-
const nodeToStrings = function (node) {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
switch (node.name()) {
|
|
55
|
-
case 'exam-title':
|
|
56
|
-
return [cleanString(node.text())];
|
|
57
|
-
case 'section': {
|
|
58
|
-
const sectionTitle = cleanString(node.get('./e:section-title', schema_1.ns).text());
|
|
59
|
-
return [
|
|
60
|
-
`\n### ${targetLanguage === 'sv-FI' ? 'Del' : 'Osa'} ${getDisplayNumber(node)}: ${sectionTitle} (${getMaxScore(node)} p.)`,
|
|
61
|
-
];
|
|
62
|
-
}
|
|
63
|
-
case 'question': {
|
|
64
|
-
const displayNumber = getDisplayNumber(node);
|
|
65
|
-
const isTopLevelQuestion = !displayNumber.includes('.');
|
|
66
|
-
const answerTypesInQuestion = findQuestionTypes(node);
|
|
67
|
-
const questionTitle = cleanString(node.find('e:question-title', schema_1.ns)[0].text());
|
|
68
|
-
return [
|
|
69
|
-
`\n${isTopLevelQuestion ? '#### ' : ''}${displayNumber}. ${questionTitle} (${getMaxScore(node)} p.) ${isTopLevelQuestion ? '' : '(' + answerTypesInQuestion.join(', ') + ')'}\n`,
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
case 'choice-answer': {
|
|
73
|
-
return [optionsWithScoresString(node, 'e:choice-answer-option')];
|
|
74
|
-
}
|
|
75
|
-
case 'scored-text-answer': {
|
|
76
|
-
return [
|
|
77
|
-
`- ${getDisplayNumber(node)}. ${(_b = (_a = node.get('./e:hint', schema_1.ns)) === null || _a === void 0 ? void 0 : _a.text().trim()) !== null && _b !== void 0 ? _b : ''}\n${node
|
|
78
|
-
.find('.//e:accepted-answer[@score]', schema_1.ns)
|
|
79
|
-
.map((elem) => ` - ${cleanString(elem.text())} (${getScore(elem)} p.)`)
|
|
80
|
-
.join('\n')}`,
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
case 'dropdown-answer': {
|
|
84
|
-
return [optionsWithScoresString(node, 'e:dropdown-answer-option')];
|
|
85
|
-
}
|
|
86
|
-
default:
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const processNode = (node) => {
|
|
91
|
-
if (node.type() !== 'element') {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
const childNodes = node.childNodes();
|
|
95
|
-
return childNodes.length !== 0 ? [...nodeToStrings(node), ...childNodes.map(processNode)] : [];
|
|
96
|
-
};
|
|
97
|
-
return ramda_1.default.flatten(doc.childNodes().map(processNode)).join('\n').trim();
|
|
98
|
-
};
|
|
99
|
-
exports.createHvp = createHvp;
|
|
100
|
-
//# sourceMappingURL=createHvp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createHvp.js","sourceRoot":"","sources":["../../src/mastering/createHvp.js"],"names":[],"mappings":";;;;;;AAAA,kDAAqB;AACrB,qCAA6B;AAE7B;;;;;;GAMG;AACI,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE;IAC/C,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChE,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,WAAW,EAAE,EAAE,WAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IACtD,CAAC,CAAA;IAED,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,EAAE;QACjC,MAAM,mBAAmB,GAAG;YAC1B,OAAO,EAAE;gBACP,sBAAsB,EAAE,yCAAyC;gBACjE,iBAAiB,EAAE,oBAAoB;gBACvC,mBAAmB,EAAE,oBAAoB;gBACzC,eAAe,EAAE,eAAe;aACjC;YACD,OAAO,EAAE;gBACP,sBAAsB,EAAE,+BAA+B;gBACvD,iBAAiB,EAAE,cAAc;gBACjC,mBAAmB,EAAE,cAAc;gBACnC,eAAe,EAAE,UAAU;aAC5B;SACF,CAAA;QAED,MAAM,mCAAmC,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAA;QAE/E,OAAO,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC;aACpD,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,mCAAmC,CAAC,WAAW,CAAC,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