Refactor completed listener to use more of the new xAPI api functions
parent
eb02a5942d
commit
9d38f83886
|
@ -66,13 +66,10 @@ H5P.EventDispatcher.prototype.triggerXAPICompleted = function(score, maxScore) {
|
||||||
* @param {function} event - xAPI event
|
* @param {function} event - xAPI event
|
||||||
*/
|
*/
|
||||||
H5P.xAPICompletedListener = function(event) {
|
H5P.xAPICompletedListener = function(event) {
|
||||||
var statement = event.data.statement;
|
if (event.getVerb() === 'completed' && !event.getVerifiedStatementValue(['context', 'contextActivities', 'parent'])) {
|
||||||
if ('verb' in statement) {
|
var score = event.getScore();
|
||||||
if (statement.verb.id === 'http://adlnet.gov/expapi/verbs/completed') {
|
var maxScore = event.getMaxScore();
|
||||||
var score = statement.result.score.raw;
|
var contentId = event.getVerifiedStatementValue(['object', 'definition', 'extensions', 'http://h5p.org/x-api/h5p-local-content-id']);
|
||||||
var maxScore = statement.result.score.max;
|
|
||||||
var contentId = statement.object.definition.extensions['http://h5p.org/x-api/h5p-local-content-id'];
|
|
||||||
H5P.setFinished(contentId, score, maxScore);
|
H5P.setFinished(contentId, score, maxScore);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue