From: Vincent Vanwaelscappel Date: Thu, 12 Oct 2023 17:14:35 +0000 (+0200) Subject: wait #6396 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1db983eff9cd1f1a2aacba85212ee208e6d328eb;p=fluidbook-toolbox-quiz.git wait #6396 @0.5 --- diff --git a/js/quiz.score.js b/js/quiz.score.js index bb8986c..650ad69 100644 --- a/js/quiz.score.js +++ b/js/quiz.score.js @@ -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 () { diff --git a/js/quiz.screen.outro.js b/js/quiz.screen.outro.js index 473f650..936d1d8 100644 --- a/js/quiz.screen.outro.js +++ b/js/quiz.screen.outro.js @@ -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 += '
  • '; html += '

    ' + this.quiz.l10n.__('Question :index', {index: i + 1}) + titleType + '

    '; - if(review.type === "multiple") { + if (review.type === "multiple") { html += '

    ' + review.question + '

    '; for (var j in correctAnswers) { html += '

    ' + correctAnswers[j].answer + '

    '; } } - if(review.type === "draganddrop") { + if (review.type === "draganddrop") { html += '
    ' - html += '

    '+review.data.area_1.title+'

    '+review.data.area_2.title+'

    ' + html += '

    ' + review.data.area_1.title + '

    ' + review.data.area_2.title + '

    ' html += '
    ' html += '
    ' for (let i = 1; i < 3; i++) { let area = i === 1 ? review.data.area_1 : review.data.area_2 - html += '
    ' + html += '
    ' html += '
      ' for (let k in correctAnswers) { - if(correctAnswers[k].drop_area === i) { - html += '
    • '+correctAnswers[k].answer+'

    • ' + if (correctAnswers[k].drop_area === i) { + html += '
    • ' + correctAnswers[k].answer + '

    • ' } } html += '
    ' @@ -209,15 +213,15 @@ QuizScreenOutro.prototype = { html += '
    ' } - if(review.type === "match") { + if (review.type === "match") { html += '
    ' html += '
    ' - html += '

    '+this.quiz.l10n.__('Question')+'

    '+this.quiz.l10n.__('Answers')+'

    ' + html += '

    ' + this.quiz.l10n.__('Question') + '

    ' + this.quiz.l10n.__('Answers') + '

    ' html += '
    ' for (let k in correctAnswers) { html += '
    ' - html += '

    '+correctAnswers[k].answer+'

    ' - html += '

    '+correctAnswers[k].proposition+'

    ' + html += '

    ' + correctAnswers[k].answer + '

    ' + html += '

    ' + correctAnswers[k].proposition + '

    ' html += '
    ' } html += '
    ' diff --git a/views/index.blade.php b/views/index.blade.php index 54678a9..cc3f4c8 100644 --- a/views/index.blade.php +++ b/views/index.blade.php @@ -4,8 +4,8 @@ - - + + {{$data->title}}