From 0718a19f3b4ade106e961fe7f028241cfb130256 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Oct 2023 14:35:09 +0200 Subject: [PATCH] wip #6396 @0.5 --- js/quiz.js | 5 ++++- js/quiz.score.js | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/js/quiz.js b/js/quiz.js index ff022a8..3806ae8 100644 --- a/js/quiz.js +++ b/js/quiz.js @@ -107,7 +107,10 @@ Quiz.prototype = { }, restart: function () { - + this.score.reset(); + this.score.init(); + this.screens.intro.show(); + this.progressbar.update(); } } diff --git a/js/quiz.score.js b/js/quiz.score.js index eb61509..9c12405 100644 --- a/js/quiz.score.js +++ b/js/quiz.score.js @@ -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; } -- 2.39.5