From 491ed24c0b6e25e1f02c8074c526d1cece3d160a Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 14 Oct 2016 16:48:03 +0200 Subject: [PATCH] Tweaks to make randomization work. HFP-56 --- js/questionset.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 8843084..4062c4a 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -136,8 +136,10 @@ H5P.QuestionSet = function (options, contentId, contentData) { var showingSolutions = false; contentData = contentData || {}; var answerIndex; - if (contentData.previousState && contentData.previousState.progress) { - currentQuestion = contentData.previousState.progress; + if (contentData.previousState) { + if (contentData.previousState.progress) { + currentQuestion = contentData.previousState.progress; + } answerIndex = contentData.previousState.order; } @@ -161,7 +163,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Instantiate question instances for (var i = 0; i < params.questions.length; i++) { - var question = params.questions[i]; + var question = params.questions[answerIndex[i]]; if (override) { // Extend subcontent with the overrided settings. @@ -426,7 +428,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { var randomizeQuestions = function () { - if (!params.randomizeQuestions) { + if (!params.randomQuestions) { return false; }