From f4d1fde0e8d944f54e2d17614b463220fa50b104 Mon Sep 17 00:00:00 2001 From: Frank Ronny Larsen Date: Thu, 7 Nov 2013 11:43:52 +0100 Subject: [PATCH] HFJ-1: Re-added postUserStatistics stuff lost in QuestionSet --- js/questionset.js | 13 +++++++++++-- library.json | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 72db963..c661543 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -108,7 +108,8 @@ H5P.QuestionSet = function (options, contentId) { showAnimations: false, successVideo: undefined, failVideo: undefined - } + }, + postUserStatistics: (H5P.postUserStatistics === true) }; var template = new EJS({text: texttemplate}); @@ -130,6 +131,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); } @@ -170,7 +175,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(); } @@ -220,6 +225,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; diff --git a/library.json b/library.json index 5a2978a..b9a2937 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 0, - "patchVersion": 30, + "patchVersion": 31, "runnable": 1, "fullscreen": 0, "machineName": "H5P.QuestionSet",