allow packet to specific question order

This commit is contained in:
Ross
2020-12-27 23:33:48 +00:00
parent 08eed53825
commit 017d2e5b6b
+14 -8
View File
@@ -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 != window.questions.length) {
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) {
@@ -391,6 +393,10 @@ function setUpPacket(data, packet_name) {
window.questions = data;
}
if (data.hasOwnProperty("exam_order")) {
window.question_order = data.exam_order;
}
// Either continue session or create a new one
db.session
// .where("status")