Trigger attempted event the first time a user sees a question - HFJ-1397

pull/10/head
Svein-Tore Griff With 2015-11-27 20:49:49 +01:00
parent 5aec15061c
commit 3a2bb0a2fd
1 changed files with 8 additions and 2 deletions

View File

@ -93,7 +93,13 @@ H5P.EventDispatcher.prototype.triggerXAPIScored = function (score, maxScore, ver
}; };
H5P.EventDispatcher.prototype.setActivityStarted = function() { H5P.EventDispatcher.prototype.setActivityStarted = function() {
this.activityStartTime = Date.now(); if (this.activityStartTime === undefined) {
// Don't trigger xAPI events in the editor
if (H5PIntegration.contents['cid-' + this.contentId] !== undefined) {
this.triggerXAPI('attempted');
}
this.activityStartTime = Date.now();
}
}; };
/** /**
@ -108,4 +114,4 @@ H5P.xAPICompletedListener = function (event) {
var contentId = event.getVerifiedStatementValue(['object', 'definition', 'extensions', 'http://h5p.org/x-api/h5p-local-content-id']); var contentId = event.getVerifiedStatementValue(['object', 'definition', 'extensions', 'http://h5p.org/x-api/h5p-local-content-id']);
H5P.setFinished(contentId, score, maxScore); H5P.setFinished(contentId, score, maxScore);
} }
}; };