@programisto/edrm-exams 0.2.10 → 0.2.12
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.
|
@@ -30,7 +30,7 @@ const contextBuilder = {
|
|
|
30
30
|
const instruction = question.instruction;
|
|
31
31
|
const maxScore = question.maxScore;
|
|
32
32
|
const questionType = question.questionType;
|
|
33
|
-
const possibleResponses = question.possibleResponses.map((response, index) => `réponse ${index + 1} = ${response}`).join('\n');
|
|
33
|
+
const possibleResponses = question.possibleResponses.map((response, index) => `réponse ${index + 1} = "${response.possibleResponse}" (${response.valid ? 'correcte' : 'incorrecte'})`).join('\n');
|
|
34
34
|
const context = {
|
|
35
35
|
instruction,
|
|
36
36
|
response,
|
|
@@ -346,7 +346,12 @@ class ExamsRouter extends EnduranceRouter {
|
|
|
346
346
|
if (!test) {
|
|
347
347
|
return res.status(404).json({ message: 'no test founded with this id' });
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
// Supprimer la question du tableau questions en filtrant par questionId
|
|
350
|
+
test.questions = test.questions.filter(q => q.questionId.toString() !== questionId);
|
|
351
|
+
// Recalculer les ordres pour que ça se suive
|
|
352
|
+
test.questions.forEach((q, index) => {
|
|
353
|
+
q.order = index + 1;
|
|
354
|
+
});
|
|
350
355
|
await test.save();
|
|
351
356
|
res.status(200).json({ message: 'question deleted with sucess' });
|
|
352
357
|
});
|
|
@@ -827,7 +832,7 @@ class ExamsRouter extends EnduranceRouter {
|
|
|
827
832
|
const otherQuestions = await TestQuestion.find({ _id: { $in: otherQuestionsIds } });
|
|
828
833
|
// Calculer combien de questions générer pour cette catégorie
|
|
829
834
|
const remainingQuestions = numberOfQuestions - questionsGenerated;
|
|
830
|
-
const questionsForThisCategory = Math.min(remainingQuestions,
|
|
835
|
+
const questionsForThisCategory = Math.min(remainingQuestions, Math.ceil(numberOfQuestions / categoriesToUse.length));
|
|
831
836
|
for (let i = 0; i < questionsForThisCategory; i++) {
|
|
832
837
|
const generatedQuestion = await generateLiveMessage('createQuestion', {
|
|
833
838
|
job: test.targetJob,
|