]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6396 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 12:35:09 +0000 (14:35 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 12:35:09 +0000 (14:35 +0200)
js/quiz.js
js/quiz.score.js

index ff022a843b93e7b107f038fb5279ba0a93902baf..3806ae8d50f521e98b2482a4bcd041edf120e3ef 100644 (file)
@@ -107,7 +107,10 @@ Quiz.prototype = {
     },
 
     restart: function () {
-
+        this.score.reset();
+        this.score.init();
+        this.screens.intro.show();
+        this.progressbar.update();
     }
 }
 
index eb615090cd1ab704528584a8362b710ebc24ea69..9c124058cd0b095863d203265a488391c14a6cdf 100644 (file)
@@ -1,12 +1,6 @@
 function QuizScore(quiz) {
     this.quiz = quiz;
-    this.logQuestions = [];
-    // Le score global du quiz
-    this.score = 0;
-    this.maxScore = 0;
-    this.questionStatus = [];
-    this.answers = [];
-    this.lastAnsweredQuestion = -1;
+    this.reset();
 }
 
 QuizScore.prototype = {
@@ -14,6 +8,16 @@ QuizScore.prototype = {
         this.updateScore();
     },
 
+    reset: function () {
+        this.logQuestions = [];
+        // Le score global du quiz
+        this.score = 0;
+        this.maxScore = 0;
+        this.questionStatus = [];
+        this.answers = [];
+        this.lastAnsweredQuestion = -1;
+    },
+
     /**
      *
      * @param questionIndex integer
@@ -185,8 +189,7 @@ QuizScore.prototype = {
         return {
             q: this.lastAnsweredQuestion, a: this.answers
         };
-    },
-    execAction: function (action) {
+    }, execAction: function (action) {
         if (action === undefined || action === null || action === '' || !action) {
             return;
         }