From 84e83b6a8f538448b3308a40a2f3e86de125a91b Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 19 Sep 2013 14:51:17 +0200 Subject: [PATCH] HJ-14: Added H5P.setFinished to all libraries. Fixed bug in dragquestion causing boardgame to not show results. --- js/questionset.js | 14 +++++++++++--- library.json | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 5e0ca82..a3b8d41 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -105,7 +105,8 @@ H5P.QuestionSet = function (options, contentId) { showAnimations: false, successVideo: undefined, failVideo: undefined - } + }, + postUserStatistics: (H5P.postUserStatistics === true) }; var template = new EJS({text: texttemplate}); @@ -127,6 +128,10 @@ H5P.QuestionSet = function (options, contentId) { // TODO: Render on init, inject in template. var libraryObject = H5P.libraryFromString(question.library); + $.extend(question.params, { + displaySolutionsButton: false, + postUserStatistics: false + }); var tmp = new (H5P.classFromName(libraryObject.machineName))(question.params, contentId); questionInstances.push(tmp); } @@ -167,7 +172,7 @@ H5P.QuestionSet = function (options, contentId) { $('.question-container', $myDom).hide().eq(questionNumber).show(); // Trigger resize on question in case the size of the QS has changed. - if (questionInstances[questionNumber].resize) { + if (questionInstances[questionNumber].resize !== undefined) { questionInstances[questionNumber].resize(); } @@ -217,6 +222,10 @@ H5P.QuestionSet = function (options, contentId) { passed: success }; var displayResults = function () { + if (params.postUserStatistics === true) { + H5P.setFinished(contentId, getScore(), totalScore()); + } + if (!params.endGame.showResultPage) { $(returnObject).trigger('h5pQuestionSetFinished', eventData); return; @@ -302,7 +311,6 @@ H5P.QuestionSet = function (options, contentId) { var question = questionInstances[i]; question.attach($('.question-container:eq(' + i + ')', $myDom)); - question.$solutionButton.hide(); $(question).on('h5pQuestionAnswered', function () { $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); _updateButtons(); diff --git a/library.json b/library.json index 2d05b20..6d344f1 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 0, - "patchVersion": 27, + "patchVersion": 28, "runnable": 1, "fullscreen": 0, "machineName": "H5P.QuestionSet",