Skip to content

Commit

Permalink
Fixes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPeek committed Apr 29, 2021
1 parent 1423227 commit b933f9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ For a guide on the difference between using two curly braces and three curly bra
No known limitations.

----------------------------
**Version number:** 2.4.2
**Version number:** 2.4.3
**Framework versions:** 2+
**Author / maintainer:** DeltaNet, forked from [adapt-contrib-assessmentResultsTotal](https://github.com/adaptlearning/adapt-contrib-assessmentResultsTotal)
**Accessibility support:** WAI AA
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt-contrib-assessmentResultsTotal-audio",
"version": "2.4.2",
"version": "2.4.3",
"framework": ">=2",
"homepage": "https://github.com/deltanet/adapt-contrib-assessmentResultsTotal-audio",
"issues": "https://github.com/deltanet/adapt-contrib-assessmentResultsTotal-audio/issues",
Expand Down
12 changes: 11 additions & 1 deletion js/assessmentResultsTotalAudioModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,33 @@ define([
var score = 0;
var maxScore = 0;
var totalAssessments = 0;
var assessmentsPassed = 0;
var isPercentageBased = Adapt.course.get('_assessment')._isPercentageBased;
var isPass = false;

for (var id in states) {
var state = states[id];
if (!state.includeInTotalScore) continue;
totalAssessments++;
maxScore += state.maxScore / state.assessmentWeight;
score += state.score / state.assessmentWeight;
if (state.isPass) {
assessmentsPassed++;
}
}

var scoreAsPercent = Math.round((score / maxScore) * 100);

if (assessmentsPassed == totalAssessments) {
isPass = true;
}

return {
isPercentageBased: isPercentageBased,
scoreAsPercent: scoreAsPercent,
maxScore: maxScore,
score: score
score: score,
isPass: isPass
};
},

Expand Down

0 comments on commit b933f9f

Please sign in to comment.