From f724885a8c302d3fba47905ac438188366de97b0 Mon Sep 17 00:00:00 2001 From: soufiane Date: Fri, 11 Aug 2023 12:18:28 +0200 Subject: [PATCH] =?utf8?q?wip=20#6182=20@0:20=20(correction=20bug)=20renvo?= =?utf8?q?yer=20une=20r=C3=A9ponse=20vide=20lorsque=20le=20joueur=20valide?= =?utf8?q?=20sans=20choisir=20de=20r=C3=A9ponse?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- resources/quizv2/js/quiz.js | 22 +++++++++++++++---- resources/quizv2/style/105-outro.sass | 6 ++++- .../views/quizv2/screens/outro.blade.php | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/resources/quizv2/js/quiz.js b/resources/quizv2/js/quiz.js index dd28bfd07..90957606e 100644 --- a/resources/quizv2/js/quiz.js +++ b/resources/quizv2/js/quiz.js @@ -98,6 +98,7 @@ Quiz.prototype = { $(document).on("click", ".next .action", function () { let responses = $this.responses $this.next(responses); + $this.responses = [] }) key('space', function (e){ e.preventDefault() @@ -110,7 +111,6 @@ Quiz.prototype = { }) key('r', function (e){ e.preventDefault() - console.log(e) $this.resetForm() }) @@ -185,14 +185,15 @@ Quiz.prototype = { } }, - // + // marque page automatique + // si le joueur recharge la page, le rediriger là où il en était setDisplay: function() { const currentQuestion = quiz.score.lastAnsweredQuestion + 1, questions = this.quiz.questions if(questions.length > 0) { if (quiz.score.lastAnsweredQuestion > -1 && questions.length <= currentQuestion) { - + // } } }, @@ -290,6 +291,13 @@ Quiz.prototype = { let status = quiz.score.questionStatus let reviewList = this.question.getAll(); + const counter = $("#progress-counter") + if(score < (maxScore / 2)) { + counter.addClass("nok") + }else if(score >= (maxScore / 2)) { + counter.addClass("ok") + } + reviewList = reviewList.map((c,i) => { return { 'question': c['question'], @@ -304,9 +312,15 @@ Quiz.prototype = { $("[id^=score-]").text(score) $("[id^=maxScore-]").text(maxScore) + // + // HANDLEBARS TEMPLATING + // + // on applique une incrementation de +1 + // utilisé pour la numérotation des questions Handlebars.registerHelper("inc", (value) => { return parseInt(value) + 1; }); - const source = $("#template").html(); + // on envoie le html avec les nouvelles données + const source = $("#template-answers-review").html(); const template = Handlebars.compile(source); const html = template({reviewList: reviewList}); $ul.html(html) diff --git a/resources/quizv2/style/105-outro.sass b/resources/quizv2/style/105-outro.sass index 0b2e9da5f..0438c0ee8 100644 --- a/resources/quizv2/style/105-outro.sass +++ b/resources/quizv2/style/105-outro.sass @@ -42,6 +42,11 @@ border-radius: 100px background: transparent +flex-config(center,false,false,center) + &.nok * + color: $nok-color + &.ok * + color: $ok-color + svg overflow: visible width: calc(100% - 12px) @@ -53,7 +58,6 @@ circle:not(#progress-circle) +opacity(.16,color,$texts-color) circle#progress-circle - color: $ok-color transition: stroke-dashoffset 0.5s ease-in-out &-answers-review diff --git a/resources/views/quizv2/screens/outro.blade.php b/resources/views/quizv2/screens/outro.blade.php index e289f9042..d0b141677 100644 --- a/resources/views/quizv2/screens/outro.blade.php +++ b/resources/views/quizv2/screens/outro.blade.php @@ -5,7 +5,7 @@
- 0/0 + 0/0 @@ -37,7 +37,7 @@

Review your answers before you go

    @verbatim -