@programisto/edrm-exams 0.3.14 → 0.3.15
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.
|
@@ -1166,7 +1166,7 @@ class ExamsRouter extends EnduranceRouter {
|
|
|
1166
1166
|
*/
|
|
1167
1167
|
this.put('/test/addCustomQuestion/:id', authenticatedOptions, async (req, res) => {
|
|
1168
1168
|
const { id } = req.params;
|
|
1169
|
-
const { questionType, instruction, maxScore, time, categoryId } = req.body;
|
|
1169
|
+
const { questionType, instruction, maxScore, time, categoryId, possibleResponses, textType } = req.body;
|
|
1170
1170
|
try {
|
|
1171
1171
|
const test = await Test.findById(id);
|
|
1172
1172
|
if (!test) {
|
|
@@ -1186,7 +1186,9 @@ class ExamsRouter extends EnduranceRouter {
|
|
|
1186
1186
|
instruction,
|
|
1187
1187
|
maxScore,
|
|
1188
1188
|
time,
|
|
1189
|
-
...(categoryId != null && categoryId !== '' ? { categoryId } : {})
|
|
1189
|
+
...(categoryId != null && categoryId !== '' ? { categoryId } : {}),
|
|
1190
|
+
...(textType != null && textType !== '' ? { textType } : {}),
|
|
1191
|
+
...(questionType === 'MCQ' && Array.isArray(possibleResponses) ? { possibleResponses } : {})
|
|
1190
1192
|
});
|
|
1191
1193
|
await question.save();
|
|
1192
1194
|
test.questions.push({ questionId: question._id, order: test.questions.length });
|