]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6184 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Jul 2023 17:55:22 +0000 (19:55 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Jul 2023 17:55:22 +0000 (19:55 +0200)
resources/quizv2/js/quiz.score.js

index ef2222d25cbabca51adfd86cff35817261d69ee1..e59ccf2f91fcd5e8009f7147c2abd85433056c79 100644 (file)
@@ -39,7 +39,7 @@ QuizScore.prototype = {
         let question = this.quiz.data.questions[questionIndex];
 
         let a = [];
-        let ok = true;
+        let ok = 'ok';
         let count = question.count_for_score;
         let log = {
             'count': count,
@@ -50,7 +50,7 @@ QuizScore.prototype = {
         let min_score = 0;
         let this_score = 0;
         if (userAnswers === undefined || userAnswers === null) {
-            ok = null;
+            ok = 'not answered';
         } else {
             let $this = this;
             if (question.type === 'multiple') {
@@ -82,7 +82,7 @@ QuizScore.prototype = {
                         }
                     }
                 }
-                ok = this_score >= min_score;
+                ok = this_score >= min_score ? 'ok' : 'nok';
 
                 log.answer = a;
             } else {
@@ -90,6 +90,10 @@ QuizScore.prototype = {
             }
         }
 
+        if (!count) {
+            ok = 'ok';
+        }
+
         this.questionStatus[questionIndex] = {
             ok: ok,
             answers: answersStatus,
@@ -99,7 +103,7 @@ QuizScore.prototype = {
 
         if (count) {
             this.maxScore++;
-            if (ok) {
+            if (ok == 'ok') {
                 this.score++;
                 log.score = 1;
             } else {