]> _ Git - fluidbook-toolbox.git/commitdiff
wait #4029 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 14:44:25 +0000 (15:44 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 14:44:25 +0000 (15:44 +0100)
resources/quiz/js/main.js

index 7a7407eccd8b14154c9ee8bcea6a75cedfdc0200..e3aa5d9d19aaaf19e2927bea98215699010e8508 100644 (file)
@@ -2,6 +2,7 @@
     $(function () {
         var data;
         var score;
+        var questionStatus = {};
         $.ajax(
             {
                 url: 'data.xml',
                     return;
                 }
             }
+            updateScore();
             if ($(question).attr('data-count') == '0') {
                 ok = null;
             } else {
-                var ok = true;
-                $(question).find('.answer').each(function () {
-                    if (($(this).attr('data-correct') == '1') != $(this).hasClass('active')) {
-                        ok = false;
-                        return false;
-                    }
-                });
+                ok = questionStatus[$(question).data('q')]
             }
-            updateScore();
+
             displayBadge(ok);
             resizeContainer();
         }
                         }
                     });
                     ok = this_score >= min_score;
+
                     answers.push(a);
                     log.answer = a;
                 } else {
                     log.answer = $(this).find('input').val();
                 }
 
+                questionStatus[qn] = ok;
+
                 var b = $("#correction .correction[data-i='" + qn + "'] .badge");
                 $(b).removeClass('correct').removeClass('incorrect').addClass(ok ? 'correct' : 'incorrect');
                 if (ok && count) {