Add getMaxScore and deprecate totalScore

pull/4/head^2
Tom Arild Jakobsen 2016-10-10 11:21:06 +02:00
parent 85bdfabb85
commit 02f98007cc
1 changed files with 12 additions and 3 deletions

View File

@ -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.
*