From: Vincent Vanwaelscappel Date: Fri, 18 Aug 2023 16:33:17 +0000 (+0200) Subject: wip #6182 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=73a9555e81f954ab0fe1035b23cfbfe28263def7;p=fluidbook-toolbox-quiz.git wip #6182 @0.5 --- diff --git a/js/quiz.score.js b/js/quiz.score.js index 8e0284c..c395771 100644 --- a/js/quiz.score.js +++ b/js/quiz.score.js @@ -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 }; diff --git a/js/quiz.screens.js b/js/quiz.screens.js index 72f5955..1c71a9f 100644 --- a/js/quiz.screens.js +++ b/js/quiz.screens.js @@ -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: () => {