From c9aa89db5778012e16ca945214bf510489a73ae8 Mon Sep 17 00:00:00 2001 From: Robert Peek Date: Wed, 26 Jan 2022 15:00:00 +0000 Subject: [PATCH] Fixes #36 --- README.md | 2 +- bower.json | 2 +- js/assessmentResultsTotalAudioModel.js | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f95d7a..a8600d5 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ For a guide on the difference between using two curly braces and three curly bra No known limitations. ---------------------------- -**Version number:** 3.1.2 +**Version number:** 3.1.3 **Framework versions:** 5+ **Author / maintainer:** DeltaNet, forked from [adapt-contrib-assessmentResultsTotal](https://github.com/adaptlearning/adapt-contrib-assessmentResultsTotal) **Accessibility support:** WAI AA diff --git a/bower.json b/bower.json index 2cb036a..e194a03 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "adapt-contrib-assessmentResultsTotal-audio", - "version": "3.1.2", + "version": "3.1.3", "framework": ">=5", "homepage": "https://github.com/deltanet/adapt-contrib-assessmentResultsTotal-audio", "issues": "https://github.com/deltanet/adapt-contrib-assessmentResultsTotal-audio/issues", diff --git a/js/assessmentResultsTotalAudioModel.js b/js/assessmentResultsTotalAudioModel.js index 8bf2638..945f5b0 100644 --- a/js/assessmentResultsTotalAudioModel.js +++ b/js/assessmentResultsTotalAudioModel.js @@ -140,13 +140,23 @@ define([ var score = 0; var maxScore = 0; var totalAssessments = 0; + var numPassed = 0; var isPercentageBased = Adapt.course.get('_assessment')._isPercentageBased; + var isPass = false; for (var id in states) { var state = states[id]; totalAssessments++; maxScore += state.maxScore / state.assessmentWeight; score += state.score / state.assessmentWeight; + + if (state.isPass) { + numPassed ++; + } + } + + if (numPassed == totalAssessments) { + isPass = true; } var scoreAsPercent = Math.round((score / maxScore) * 100); @@ -155,7 +165,8 @@ define([ isPercentageBased: isPercentageBased, scoreAsPercent: scoreAsPercent, maxScore: maxScore, - score: score + score: score, + isPass: isPass }; }