From 2ed388abee0bb9fed3a4fb53c1eae44f9992d541 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Sat, 28 Nov 2015 22:06:19 +0100 Subject: [PATCH] Add attempted, interacted and completed statements - HFJ-1402 --- memory-game.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/memory-game.js b/memory-game.js index 3f22418..98166b8 100644 --- a/memory-game.js +++ b/memory-game.js @@ -41,6 +41,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { timer.stop(); popup.show(desc, card.getImage(), function () { if (finished) { + self.triggerXAPIScored(1, 1, 'completed'); // Game has finished $feedback.addClass('h5p-show'); } @@ -51,6 +52,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { }); } else if (finished) { + self.triggerXAPIScored(1, 1, 'completed'); // Game has finished timer.stop(); $feedback.addClass('h5p-show'); @@ -72,6 +74,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { */ var addCard = function (card, mate) { card.on('flip', function () { + self.triggerXAPI('interacted'); // Keep track of time spent timer.start(); @@ -112,6 +115,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { * @param {H5P.jQuery} $container */ self.attach = function ($container) { + this.triggerXAPI('attempted'); // TODO: Only create on first! $container.addClass('h5p-memory-game').html('');