From c6b8ad44e4c2e8a938da19bcb933d39851cf8c0f Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 26 May 2016 14:07:14 +0200 Subject: [PATCH] Don't require that the user removes the final description to trigger completed https://www.drupal.org/node/2730223 --- memory-game.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/memory-game.js b/memory-game.js index 98166b8..6ca5e48 100644 --- a/memory-game.js +++ b/memory-game.js @@ -36,12 +36,15 @@ H5P.MemoryGame = (function (EventDispatcher, $) { var finished = (removed === cards.length); var desc = card.getDescription(); + if (finished) { + self.triggerXAPIScored(1, 1, 'completed'); + } + if (desc !== undefined) { // Pause timer and show desciption. timer.stop(); popup.show(desc, card.getImage(), function () { if (finished) { - self.triggerXAPIScored(1, 1, 'completed'); // Game has finished $feedback.addClass('h5p-show'); } @@ -52,7 +55,6 @@ H5P.MemoryGame = (function (EventDispatcher, $) { }); } else if (finished) { - self.triggerXAPIScored(1, 1, 'completed'); // Game has finished timer.stop(); $feedback.addClass('h5p-show');