]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6182 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 18 Aug 2023 16:33:17 +0000 (18:33 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 18 Aug 2023 16:33:17 +0000 (18:33 +0200)
js/quiz.score.js
js/quiz.screens.js

index 8e0284ca56fa395797f7ef86613961bfcab8a55e..c395771ab23757fec6151c898211217c3b0d6bf7 100644 (file)
@@ -31,7 +31,8 @@ QuizScore.prototype = {
             ok: this.questionStatus[questionIndex].ok,
             score: this.score,
             maxScore: this.maxScore,
-            status: this.questionStatus
+            status: this.questionStatus,
+            answersStatus: this.questionStatus[questionIndex].answers,
         };
     },
 
@@ -95,9 +96,7 @@ QuizScore.prototype = {
         }
 
         this.questionStatus[questionIndex] = {
-            ok: ok,
-            answers: answersStatus,
-            // dbg_min_score: min_score,
+            ok: ok, answers: answersStatus, // dbg_min_score: min_score,
             // dbg_this_score: this_score
         };
 
index 72f59554886c2c2ac54a69ad143336bd83e69996..1c71a9f56c26d9ff64f01b8ff46e65b3775290b7 100644 (file)
@@ -31,7 +31,7 @@ QuizScreens.prototype = {
             if ($(this).hasClass('validate')) {
                 let review = $this.sendUserAnswers();
                 // Si la revue instantanée est activée, on affiche les résultats
-                if (this.quiz.data.instantReview) {
+                if ($this.quiz.data.instantReview) {
                     $this.instantReview(review);
                 } else {
                     // Sinon, on passe directement à la question suivante
@@ -54,12 +54,16 @@ QuizScreens.prototype = {
         $(activeScreen).find('.btn.validate').addClass('none');
         $(activeScreen).find('.btn.continue').removeClass('none');
 
+        let results=review.answersStatus;
+        console.log(review);
+
         for (let k in results) {
+            console.log(k);
             let answerResult = results[k];
 
             let n = (parseInt(k) + 1);
             let icon = getSpriteIcon("quiz-ok");
-            let $el = form.fid(".list-item:nth-of-type(" + n + ") label");
+            let $el = form.find(".list-item:nth-of-type(" + n + ") label");
             $el.addClass(answerResult);
             if (answerResult === "nok") {
                 icon = getSpriteIcon("quiz-wrong");
@@ -147,7 +151,7 @@ QuizScreens.prototype = {
     },
 
     getCurrentForm: function () {
-        return $(this.activeScreen).find('form');
+        return this.getActiveScreen().find('form');
     },
 
     resetForm: () => {