From 02f98007cc8de51e3b1eed39b85341c4754685b0 Mon Sep 17 00:00:00 2001 From: Tom Arild Jakobsen Date: Mon, 10 Oct 2016 11:21:06 +0200 Subject: [PATCH] Add getMaxScore and deprecate totalScore --- js/questionset.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 1e18f63..3d70079 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -469,7 +469,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Get total score. var finals = self.getScore(); - var totals = self.totalScore(); + var totals = self.getMaxScore(); var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals); var success = ((100 * finals / totals) >= params.passPercentage); var eventData = { @@ -494,7 +494,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { }; var displayResults = function () { - self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); + self.triggerXAPICompleted(self.getScore(), self.getMaxScore(), success); var eparams = { message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage, @@ -779,7 +779,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { }; // Get total score possible for questionset. - this.totalScore = function () { + this.getMaxScore = function () { var score = 0; for (var i = questionInstances.length - 1; i >= 0; i--) { score += questionInstances[i].getMaxScore(); @@ -787,6 +787,15 @@ H5P.QuestionSet = function (options, contentId, contentData) { return score; }; + + /** + * @deprecated since version 1.9.2 + * @returns {number} + */ + this.totalScore = function () { + return this.getMaxScore(); + }; + /** * Gather copyright information for the current content. *