]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wait #6396 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Oct 2023 17:14:35 +0000 (19:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Oct 2023 17:14:35 +0000 (19:14 +0200)
js/quiz.score.js
js/quiz.screen.outro.js
views/index.blade.php

index bb8986c868306cc0ce955aa9b7d0989483e599bc..650ad69ebab301b6143d24158cb555870447c7ba 100644 (file)
@@ -132,7 +132,7 @@ QuizScore.prototype = {
     },
 
     getNormalizedScore: function (pct) {
-        var s = this.score / this.getQuestionsCount();
+        var s = this.score / this.getQuestionsCount(true);
         if (pct === undefined || pct === false) {
             return s;
         }
@@ -182,8 +182,17 @@ QuizScore.prototype = {
         }
     },
 
-    getQuestionsCount: function () {
-        return this.quiz.data.questions.length;
+    getQuestionsCount: function (onlyForScore) {
+        if (onlyForScore === true) {
+            let res = 0;
+            for (let i in this.quiz.data.questions) {
+                if (this.quiz.data.questions[i].count_for_score) {
+                    res++;
+                }
+            }
+            return res;
+        }
+        this.quiz.data.questions.length;
     },
 
     getCurrentState: function () {
index 473f650f439bd7809cef2d9bd0184a2a1728d632..936d1d8c643637cfcc7bad48f58c980139c1f195 100644 (file)
@@ -118,6 +118,10 @@ QuizScreenOutro.prototype = {
         this.quiz.score.runEndAction();
         this.quiz.attemptsLog.log();
 
+        if (this.quiz.score.isPassed() || this.quiz.scorm.enabled) {
+            $(".restart,.restart-sentence,.restart-sentence-mobile").hide();
+        }
+
         this.animate(score, percent)
         this.displayReviewList()
         this.checkScorm()
@@ -170,37 +174,37 @@ QuizScreenOutro.prototype = {
 
             let correctAnswers = review.correctAnswers.length > 0 ? review.correctAnswers : review.data.answers
 
-            console.log("review",review)
-            console.log("correctAnswers",correctAnswers)
+            console.log("review", review)
+            console.log("correctAnswers", correctAnswers)
 
             let titleType = '';
-            if(review.type === "draganddrop") {
-                titleType = ' - '+this.quiz.l10n.__('Drag and Drop')
-            } else if(review.type === "match") {
-                titleType = ' - '+this.quiz.l10n.__('Match the answers')
+            if (review.type === "draganddrop") {
+                titleType = ' - ' + this.quiz.l10n.__('Drag and Drop')
+            } else if (review.type === "match") {
+                titleType = ' - ' + this.quiz.l10n.__('Match the answers')
             }
             html += '<li class="item ' + review.status + '">';
             html += '<p class="position">' + this.quiz.l10n.__('Question :index', {index: i + 1}) + titleType + '</p>';
 
-            if(review.type === "multiple") {
+            if (review.type === "multiple") {
                 html += '<p class="question">' + review.question + '</p>';
                 for (var j in correctAnswers) {
                     html += '<p class="answer">' + correctAnswers[j].answer + '</p>';
                 }
             }
 
-            if(review.type === "draganddrop") {
+            if (review.type === "draganddrop") {
                 html += '<div class="area-title">'
-                html += '<p>'+review.data.area_1.title+'</p><p>'+review.data.area_2.title+'</p>'
+                html += '<p>' + review.data.area_1.title + '</p><p>' + review.data.area_2.title + '</p>'
                 html += '</div>'
                 html += '<div class="area-container">'
                 for (let i = 1; i < 3; i++) {
                     let area = i === 1 ? review.data.area_1 : review.data.area_2
-                    html += '<div class="area area"'+i+'>'
+                    html += '<div class="area area"' + i + '>'
                     html += '<ul class="area-list card-holder">'
                     for (let k in correctAnswers) {
-                        if(correctAnswers[k].drop_area === i) {
-                            html += '<li class="area-item slot active"><p>'+correctAnswers[k].answer+'</p></li>'
+                        if (correctAnswers[k].drop_area === i) {
+                            html += '<li class="area-item slot active"><p>' + correctAnswers[k].answer + '</p></li>'
                         }
                     }
                     html += '</ul>'
@@ -209,15 +213,15 @@ QuizScreenOutro.prototype = {
                 html += '</div>'
             }
 
-            if(review.type === "match") {
+            if (review.type === "match") {
                 html += '<div class="match-container">'
                 html += '<div class="match-title">'
-                html += '<p>'+this.quiz.l10n.__('Question')+'</p><p>'+this.quiz.l10n.__('Answers')+'</p>'
+                html += '<p>' + this.quiz.l10n.__('Question') + '</p><p>' + this.quiz.l10n.__('Answers') + '</p>'
                 html += '</div>'
                 for (let k in correctAnswers) {
                     html += '<div class="match-wrapper card-holder">'
-                    html += '<div class="match-item slot active"><p>'+correctAnswers[k].answer+'</p></div>'
-                    html += '<div class="match-item slot active"><p>'+correctAnswers[k].proposition+'</p></div>'
+                    html += '<div class="match-item slot active"><p>' + correctAnswers[k].answer + '</p></div>'
+                    html += '<div class="match-item slot active"><p>' + correctAnswers[k].proposition + '</p></div>'
                     html += '</div>'
                 }
                 html += '</div>'
index 54678a944dadc4484882a3e85c0a39140013c587..cc3f4c876c09d144f46f7f75841537278c55cfaa 100644 (file)
@@ -4,8 +4,8 @@
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no">
-    <meta name="width" content="1024">
-    <meta name="height" content="768">
+    <meta name="width" content="1200">
+    <meta name="height" content="680">
     <title>{{$data->title}}</title>
     <link type="text/css" rel="stylesheet" href="css/style.css">
 </head>