diff --git a/js/main.js b/js/main.js index e2a3c4e..7183492 100644 --- a/js/main.js +++ b/js/main.js @@ -23,7 +23,7 @@ window.number_of_questions = null; window.question_type = null; window.loaded_question = null; window.review = false; -window.exam_time = 60; +window.exam_time = null; window.date_started = null; window.score = 0; @@ -251,7 +251,7 @@ function setUpQuestions(load_previous) { } // Set an order for the questions if (!load_previous) { - if (window.question_order.length != window.questions.length) { + if (window.question_order.length < 1) { window.question_order = []; Object.keys(window.questions).forEach(function (e) { window.question_order.push(e); @@ -290,7 +290,8 @@ function setUpQuestions(load_previous) { console.log(window.question_type); - if (!load_previous) { + // exam_time can be defined in packets + if (!load_previous && window.exam_time == null) { if (window.question_type == "rapid") { window.exam_time = 35 * 60; } else if (window.question_type == "anatomy") { @@ -397,6 +398,10 @@ function setUpPacket(data, packet_name) { window.question_order = data.exam_order; } + if (data.hasOwnProperty("exam_time")) { + window.exam_time = data.exam_time; + } + // Either continue session or create a new one db.session // .where("status")