Add getMaxScore and deprecate totalScore
parent
85bdfabb85
commit
02f98007cc
|
@ -469,7 +469,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
|
|
||||||
// Get total score.
|
// Get total score.
|
||||||
var finals = self.getScore();
|
var finals = self.getScore();
|
||||||
var totals = self.totalScore();
|
var totals = self.getMaxScore();
|
||||||
var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals);
|
var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals);
|
||||||
var success = ((100 * finals / totals) >= params.passPercentage);
|
var success = ((100 * finals / totals) >= params.passPercentage);
|
||||||
var eventData = {
|
var eventData = {
|
||||||
|
@ -494,7 +494,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var displayResults = function () {
|
var displayResults = function () {
|
||||||
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success);
|
self.triggerXAPICompleted(self.getScore(), self.getMaxScore(), success);
|
||||||
|
|
||||||
var eparams = {
|
var eparams = {
|
||||||
message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage,
|
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.
|
// Get total score possible for questionset.
|
||||||
this.totalScore = function () {
|
this.getMaxScore = function () {
|
||||||
var score = 0;
|
var score = 0;
|
||||||
for (var i = questionInstances.length - 1; i >= 0; i--) {
|
for (var i = questionInstances.length - 1; i >= 0; i--) {
|
||||||
score += questionInstances[i].getMaxScore();
|
score += questionInstances[i].getMaxScore();
|
||||||
|
@ -787,6 +787,15 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
return score;
|
return score;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 1.9.2
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
this.totalScore = function () {
|
||||||
|
return this.getMaxScore();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gather copyright information for the current content.
|
* Gather copyright information for the current content.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue