]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wait #6395 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 11:42:55 +0000 (13:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 11:42:55 +0000 (13:42 +0200)
js/quiz.score.js
js/quiz.screen.outro.js

index 80be4958ad1050bb304ea80a52e19093ce7c8cb6..eb615090cd1ab704528584a8362b710ebc24ea69 100644 (file)
@@ -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);
+        }
     }
 };
 
index 069b6fdf9c955c86929130de797bd953cc1369c8..89781352375a6a1304dcedd37b293dae72363a9f 100644 (file)
@@ -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()