allow packet to specific question order
This commit is contained in:
+14
-8
@@ -251,15 +251,17 @@ function setUpQuestions(load_previous) {
|
|||||||
}
|
}
|
||||||
// Set an order for the questions
|
// Set an order for the questions
|
||||||
if (!load_previous) {
|
if (!load_previous) {
|
||||||
window.question_order = [];
|
if (window.question_order.length != window.questions.length) {
|
||||||
Object.keys(window.questions).forEach(function (e) {
|
window.question_order = [];
|
||||||
window.question_order.push(e);
|
Object.keys(window.questions).forEach(function (e) {
|
||||||
|
window.question_order.push(e);
|
||||||
|
|
||||||
// Make sure answers are arrays
|
// Make sure answers are arrays
|
||||||
if (!Array.isArray(window.questions[e]["answers"])) {
|
if (!Array.isArray(window.questions[e]["answers"])) {
|
||||||
window.questions[e]["answers"] = [window.questions[e]["answers"]];
|
window.questions[e]["answers"] = [window.questions[e]["answers"]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let randomise_order = true;
|
let randomise_order = true;
|
||||||
if (window.config.randomise_order != undefined) {
|
if (window.config.randomise_order != undefined) {
|
||||||
@@ -391,6 +393,10 @@ function setUpPacket(data, packet_name) {
|
|||||||
window.questions = data;
|
window.questions = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.hasOwnProperty("exam_order")) {
|
||||||
|
window.question_order = data.exam_order;
|
||||||
|
}
|
||||||
|
|
||||||
// Either continue session or create a new one
|
// Either continue session or create a new one
|
||||||
db.session
|
db.session
|
||||||
// .where("status")
|
// .where("status")
|
||||||
|
|||||||
Reference in New Issue
Block a user