HJ-14: Added H5P.setFinished to all libraries.

Fixed bug in dragquestion causing boardgame to not show results.
pull/1/head
Frode Petterson 2013-09-19 14:51:17 +02:00
parent aff85ef896
commit 84e83b6a8f
2 changed files with 12 additions and 4 deletions

View File

@ -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();

View File

@ -3,7 +3,7 @@
"contentType": "question",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 27,
"patchVersion": 28,
"runnable": 1,
"fullscreen": 0,
"machineName": "H5P.QuestionSet",