@digabi/exam-engine-generator 19.7.1 → 19.8.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/testGenerateAnswers.js +12 -12
- package/dist/__tests__/testGenerateExam.js +29 -30
- package/dist/__tests__/testGenerateExam.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/generateAnswers.js +4 -4
- package/dist/generateAnswers.js.map +1 -1
- package/dist/generateExam.js +5 -5
- package/dist/generateExam.js.map +1 -1
- package/dist/generateExamOptions.js +15 -15
- package/package.json +3 -3
package/dist/generateAnswers.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateAnswers = void 0;
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
8
|
function generateAnswers(gradingStructure) {
|
9
|
-
return lodash_1.default.flatMap(gradingStructure.questions,
|
9
|
+
return lodash_1.default.flatMap(gradingStructure.questions, question => {
|
10
10
|
switch (question.type) {
|
11
11
|
case 'text':
|
12
12
|
return generateTextAnswer(question);
|
@@ -23,8 +23,8 @@ function generateTextAnswer(question) {
|
|
23
23
|
questionId: question.id,
|
24
24
|
type: 'text',
|
25
25
|
characterCount: getCharacterCount(value),
|
26
|
-
value
|
27
|
-
}
|
26
|
+
value
|
27
|
+
}
|
28
28
|
];
|
29
29
|
}
|
30
30
|
function generateChoiceAnswer(question) {
|
@@ -33,7 +33,7 @@ function generateChoiceAnswer(question) {
|
|
33
33
|
return {
|
34
34
|
questionId: choice.id,
|
35
35
|
type: 'choice',
|
36
|
-
value: String(option.id)
|
36
|
+
value: String(option.id)
|
37
37
|
};
|
38
38
|
});
|
39
39
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generateAnswers.js","sourceRoot":"","sources":["../src/generateAnswers.ts"],"names":[],"mappings":";;;;;;AACA,oDAAsB;AAEtB,SAAgB,eAAe,CAAC,gBAAkC;IAChE,OAAO,gBAAC,CAAC,OAAO,CAAC,gBAA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}
|
package/dist/generateExam.js
CHANGED
@@ -93,10 +93,10 @@ function generateExam(options) {
|
|
93
93
|
'exam-code': options.examCode,
|
94
94
|
'day-code': options.dayCode,
|
95
95
|
date: options.date,
|
96
|
-
'max-answers': options.maxAnswers
|
96
|
+
'max-answers': options.maxAnswers
|
97
97
|
});
|
98
98
|
const examVersions = (_a = options.examVersions) !== null && _a !== void 0 ? _a : [{ language: 'fi-FI' }];
|
99
|
-
const languages = examVersions.map(
|
99
|
+
const languages = examVersions.map(v => v.language);
|
100
100
|
const examVersionsElement = createElement(exam, 'exam-versions');
|
101
101
|
for (const { language, type } of examVersions) {
|
102
102
|
createElement(examVersionsElement, 'exam-version', undefined, { lang: language, 'exam-type': type });
|
@@ -114,7 +114,7 @@ function addSection(exam, languages, options) {
|
|
114
114
|
const section = createElement(exam, 'section', undefined, {
|
115
115
|
'max-answers': options.maxAnswers,
|
116
116
|
'cas-forbidden': options.casForbidden,
|
117
|
-
type: options.type
|
117
|
+
type: options.type
|
118
118
|
});
|
119
119
|
createLocalizedElement(section, 'section-title', languages, { 'fi-FI': 'Osan otsikko', 'sv-FI': 'Delens titel' });
|
120
120
|
for (const question of options.questions) {
|
@@ -125,7 +125,7 @@ function addQuestion(parent, languages, options) {
|
|
125
125
|
const question = createElement(parent, 'question', undefined, { 'max-answers': options.maxAnswers });
|
126
126
|
createLocalizedElement(question, 'question-title', languages, {
|
127
127
|
'fi-FI': 'Kysymyksen otsikko',
|
128
|
-
'sv-FI': 'Uppgiftens titel'
|
128
|
+
'sv-FI': 'Uppgiftens titel'
|
129
129
|
});
|
130
130
|
if ('questions' in options) {
|
131
131
|
for (const subQuestion of options.questions) {
|
@@ -153,7 +153,7 @@ function addTextAnswer(question, options) {
|
|
153
153
|
const answer = createElement(question, options.name, undefined, {
|
154
154
|
'max-score': options.maxScore,
|
155
155
|
'max-length': options.maxLength,
|
156
|
-
type: options.type
|
156
|
+
type: options.type
|
157
157
|
});
|
158
158
|
if (options.hint) {
|
159
159
|
createElement(answer, 'hint', options.hint);
|
package/dist/generateExam.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generateExam.js","sourceRoot":"","sources":["../src/generateExam.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmC;AAiFnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,SAAgB,YAAY,CAAC,OAA4B;;IACvD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAA;IACjC,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;QACjD,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,2CAA2C;QACxD,oBAAoB,EAAE,0EAA0E;QAChG,qBAAqB,EAAE,KAAK;QAC5B,WAAW,EAAE,OAAO,CAAC,QAAQ;QAC7B,UAAU,EAAE,OAAO,CAAC,OAAO;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,aAAa,EAAE,OAAO,CAAC,UAAU;KAClC,CAAC,CAAA;IACF,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;IACpE,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,
|
1
|
+
{"version":3,"file":"generateExam.js","sourceRoot":"","sources":["../src/generateExam.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmC;AAiFnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,SAAgB,YAAY,CAAC,OAA4B;;IACvD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAA;IACjC,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,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|
type: 'rich-text',
|
23
|
-
...options
|
23
|
+
...options
|
24
24
|
};
|
25
25
|
}
|
26
26
|
exports.textAnswer = textAnswer;
|
@@ -31,15 +31,15 @@ function scoredTextAnswer(options) {
|
|
31
31
|
acceptedAnswers: [
|
32
32
|
{
|
33
33
|
text: 'Oikea vaihtoehto',
|
34
|
-
score: 3
|
34
|
+
score: 3
|
35
35
|
},
|
36
36
|
// The legacy exam generator expects this to be the correct answer. (ノಠ益ಠ)ノ彡┻━┻
|
37
37
|
{
|
38
38
|
text: 'lol',
|
39
|
-
score: 3
|
40
|
-
}
|
39
|
+
score: 3
|
40
|
+
}
|
41
41
|
],
|
42
|
-
...options
|
42
|
+
...options
|
43
43
|
};
|
44
44
|
}
|
45
45
|
exports.scoredTextAnswer = scoredTextAnswer;
|
@@ -49,18 +49,18 @@ function choiceAnswer(options) {
|
|
49
49
|
options: [
|
50
50
|
{
|
51
51
|
text: 'Oikea vaihtoehto',
|
52
|
-
score: 3
|
52
|
+
score: 3
|
53
53
|
},
|
54
54
|
{
|
55
55
|
text: 'Väärä vaihtoehto',
|
56
|
-
score: 0
|
56
|
+
score: 0
|
57
57
|
},
|
58
58
|
{
|
59
59
|
text: 'Väärä vaihtoehto',
|
60
|
-
score: 0
|
61
|
-
}
|
60
|
+
score: 0
|
61
|
+
}
|
62
62
|
],
|
63
|
-
...options
|
63
|
+
...options
|
64
64
|
};
|
65
65
|
}
|
66
66
|
exports.choiceAnswer = choiceAnswer;
|
@@ -70,18 +70,18 @@ function dropdownAnswer(options) {
|
|
70
70
|
options: [
|
71
71
|
{
|
72
72
|
text: 'Oikea vaihtoehto',
|
73
|
-
score: 3
|
73
|
+
score: 3
|
74
74
|
},
|
75
75
|
{
|
76
76
|
text: 'Väärä vaihtoehto',
|
77
|
-
score: 0
|
77
|
+
score: 0
|
78
78
|
},
|
79
79
|
{
|
80
80
|
text: 'Väärä vaihtoehto',
|
81
|
-
score: 0
|
82
|
-
}
|
81
|
+
score: 0
|
82
|
+
}
|
83
83
|
],
|
84
|
-
...options
|
84
|
+
...options
|
85
85
|
};
|
86
86
|
}
|
87
87
|
exports.dropdownAnswer = dropdownAnswer;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@digabi/exam-engine-generator",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.8.0-alpha.3",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"author": "Matriculation Examination Board, Finland",
|
6
6
|
"license": "EUPL-1.1",
|
@@ -8,9 +8,9 @@
|
|
8
8
|
"dist"
|
9
9
|
],
|
10
10
|
"dependencies": {
|
11
|
-
"@digabi/exam-engine-core": "19.
|
11
|
+
"@digabi/exam-engine-core": "19.8.0-alpha.3",
|
12
12
|
"libxmljs2": "^0.32.0",
|
13
13
|
"lodash": "^4.17.15"
|
14
14
|
},
|
15
|
-
"gitHead": "
|
15
|
+
"gitHead": "e9655ebb690ee0b2bfa54b6e60fc3f9db2268994"
|
16
16
|
}
|