diff --git a/index.html b/index.html index ce38c71..05248b1 100644 --- a/index.html +++ b/index.html @@ -173,7 +173,7 @@
- + diff --git a/js/main.js b/js/main.js index 15da58f..9990670 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; @@ -135,7 +135,7 @@ async function loadExamList(data) { }) ); }); - if (config.exam_results_url != "") { + if (config.exam_results_url != "" && config.exam_results_url != undefined) { let url = config.exam_results_url; $("#options-link") @@ -251,15 +251,17 @@ function setUpQuestions(load_previous) { } // Set an order for the questions if (!load_previous) { - window.question_order = []; - Object.keys(window.questions).forEach(function (e) { - window.question_order.push(e); + if (window.question_order.length < 1) { + window.question_order = []; + Object.keys(window.questions).forEach(function (e) { + window.question_order.push(e); - // Make sure answers are arrays - if (!Array.isArray(window.questions[e]["answers"])) { - window.questions[e]["answers"] = [window.questions[e]["answers"]]; - } - }); + // Make sure answers are arrays + if (!Array.isArray(window.questions[e]["answers"])) { + window.questions[e]["answers"] = [window.questions[e]["answers"]]; + } + }); + } let randomise_order = true; if (window.config.randomise_order != undefined) { @@ -288,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") { @@ -391,6 +394,14 @@ function setUpPacket(data, packet_name) { window.questions = data; } + if (data.hasOwnProperty("exam_order")) { + 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") diff --git a/lib/uuidv4.min.js b/lib/uuidv4.min.js new file mode 100644 index 0000000..e9df84b --- /dev/null +++ b/lib/uuidv4.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).uuidv4=e()}(this,(function(){"use strict";var t,e=new Uint8Array(16);function o(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(t){return"string"==typeof t&&n.test(t)}for(var i=[],u=0;u<256;++u)i.push((u+256).toString(16).substr(1));return function(t,e,n){var u=(t=t||{}).random||(t.rng||o)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,e){n=n||0;for(var f=0;f<16;++f)e[n+f]=u[f];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase();if(!r(o))throw TypeError("Stringified UUID is invalid");return o}(u)}})); \ No newline at end of file