Tweaks to make randomization work.

HFP-56
pull/4/head^2
thomasmars 2016-10-14 16:48:03 +02:00
parent 6d4a915de1
commit 491ed24c0b
1 changed files with 6 additions and 4 deletions

View File

@ -136,8 +136,10 @@ H5P.QuestionSet = function (options, contentId, contentData) {
var showingSolutions = false; var showingSolutions = false;
contentData = contentData || {}; contentData = contentData || {};
var answerIndex; var answerIndex;
if (contentData.previousState && contentData.previousState.progress) { if (contentData.previousState) {
if (contentData.previousState.progress) {
currentQuestion = contentData.previousState.progress; currentQuestion = contentData.previousState.progress;
}
answerIndex = contentData.previousState.order; answerIndex = contentData.previousState.order;
} }
@ -161,7 +163,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
// Instantiate question instances // Instantiate question instances
for (var i = 0; i < params.questions.length; i++) { for (var i = 0; i < params.questions.length; i++) {
var question = params.questions[i]; var question = params.questions[answerIndex[i]];
if (override) { if (override) {
// Extend subcontent with the overrided settings. // Extend subcontent with the overrided settings.
@ -426,7 +428,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
var randomizeQuestions = function () { var randomizeQuestions = function () {
if (!params.randomizeQuestions) { if (!params.randomQuestions) {
return false; return false;
} }