text: this.quiz.l10n.__("Unfortunately, you did not get enough correct answers (:score out of :maxScore).", {
'score': score,
'maxScore': maxScore
- }) + " " + this.quiz.l10n.__("Please go back and review the content before retaking the quiz.")
- }
+ }) + " " + this.quiz.l10n.__("Please go back and review the content before retaking the quiz."),
+ showCircle: true,
+ confetti: 'CONFETTI_LOSE',
+ status: 'nok',
+ };
let ok = {
title: this.quiz.l10n.__("Congratulation!"),
text: this.quiz.l10n.__("You have completed the quiz with :score correct answers out of :maxScore", {
'score': score,
'maxScore': maxScore
- })
+ }),
+ showCircle: true,
+ confetti: 'CONFETTI_WIN',
+ status: 'ok',
+ };
+ let neutral = {
+ title: this.quiz.l10n.__('Thank you for your answers!'),
+ text: '',
+ showCircle: false,
+ confetti: false,
+ status: 'neutral',
}
- let counter = $("#container-score")
let percent = (score / maxScore) * 100
- let animConfetti = '';
- if (quiz.score.isPassed() === false) {
- animConfetti = 'CONFETTI_LOSE';
- this.displayResultContent(nok, "nok", counter)
+ let content;
+ if (!quiz.score.hasScore()) {
+ content = neutral;
+ } else if (quiz.score.isPassed() === false) {
+ content = nok;
} else {
- animConfetti = 'CONFETTI_WIN';
- this.displayResultContent(ok, "ok", counter)
+ content = ok;
}
- //
- setTimeout(function () {
- return $this.animeConfetti(animConfetti);
- }, 2500);
+ this.displayResultContent(content);
- $("[id^=score-]").text(score)
+ $("[id^=score-]").text(score);
$("[id^=maxScore-]").text(maxScore);
this.quiz.score.runEndAction();
}
},
- displayResultContent: function (result, status, counter) {
+ displayResultContent: function (result) {
+ const $this = this;
$(".score-text h1").text(result.title)
$(".score-text p").text(result.text)
- counter.addClass(status)
+ $("#container-score").addClass(result.status);
+ $("#container-score").parent().addClass(result.status);
+ $("#container-score").parent().parent().addClass(result.status);
+
+ if (result.confetti) {
+ setTimeout(function () {
+ return $this.animeConfetti(result.confetti);
+ }, 2500);
+ }
+
+ if (!result.showCircle) {
+
+ }
},
displayReviewList: function () {
.subtitle
+opacity(.8, color, $texts-color)
+
h1,
.score-text .subtitle .word,
.restart-sentence-mobile,
position: relative
z-index: 1
+ &.neutral
+ .restart, .toggle-answers-review, .restart-sentence, .restart-sentence-mobile
+ display: none !important
+
&.full
.score-content-wrapper
max-width: 60%
top: var(--space-21-66)
margin-left: 75px
+ &.neutral
+ .score-text
+ width: 100%
+
+ h1
+ text-align: center
+
&-counter
height: 0
padding-bottom: 31%
fill: $ok-color
stroke: $ok-color
+ &.neutral
+ display: none
+
#progress-counter
width: 100%
height: 100%
.area-title
display: grid
grid-template-columns: 2fr 2fr
+
p
width: 50%