Made setActivityStarted a little more robust [HFJ-1474]
parent
2d0e409ac4
commit
e6ec257c6d
|
@ -95,7 +95,7 @@ H5P.EventDispatcher.prototype.triggerXAPIScored = function (score, maxScore, ver
|
||||||
H5P.EventDispatcher.prototype.setActivityStarted = function() {
|
H5P.EventDispatcher.prototype.setActivityStarted = function() {
|
||||||
if (this.activityStartTime === undefined) {
|
if (this.activityStartTime === undefined) {
|
||||||
// Don't trigger xAPI events in the editor
|
// Don't trigger xAPI events in the editor
|
||||||
if (H5PIntegration.contents['cid-' + this.contentId] !== undefined) {
|
if (this.contentId !== undefined && H5PIntegration.contents !== undefined && H5PIntegration.contents['cid-' + this.contentId] !== undefined) {
|
||||||
this.triggerXAPI('attempted');
|
this.triggerXAPI('attempted');
|
||||||
}
|
}
|
||||||
this.activityStartTime = Date.now();
|
this.activityStartTime = Date.now();
|
||||||
|
@ -114,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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue