From 536e1f8ee96783f3687cf1744ba13a26a574be59 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Oct 2023 13:42:55 +0200 Subject: [PATCH] wait #6395 @0:20 --- js/quiz.score.js | 18 ++++++++++++++++++ js/quiz.screen.outro.js | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/js/quiz.score.js b/js/quiz.score.js index 80be495..eb61509 100644 --- a/js/quiz.score.js +++ b/js/quiz.score.js @@ -154,6 +154,14 @@ QuizScore.prototype = { return min_score; }, + runEndAction: function () { + if (this.isPassed()) { + this.execAction(this.quiz.data.passedAction); + } else { + this.execAction(this.quiz.data.failedAction); + } + }, + updateScore: function (saveState) { this.maxScore = 0; this.score = 0; @@ -177,6 +185,16 @@ QuizScore.prototype = { return { q: this.lastAnsweredQuestion, a: this.answers }; + }, + execAction: function (action) { + if (action === undefined || action === null || action === '' || !action) { + return; + } + try { + eval(action); + } catch (e) { + console.error('Error while running code ' + action + ' :: ' + e.message); + } } }; diff --git a/js/quiz.screen.outro.js b/js/quiz.screen.outro.js index 069b6fd..8978135 100644 --- a/js/quiz.screen.outro.js +++ b/js/quiz.screen.outro.js @@ -110,7 +110,9 @@ QuizScreenOutro.prototype = { }, 2500); $("[id^=score-]").text(score) - $("[id^=maxScore-]").text(maxScore) + $("[id^=maxScore-]").text(maxScore); + + this.quiz.score.runEndAction(); this.animate(score, percent) this.displayReviewList() -- 2.39.5