small fix

This commit is contained in:
Ross
2022-06-03 14:44:58 +01:00
parent b86b708157
commit 1f00b7134e
+8 -6
View File
@@ -238,7 +238,7 @@ async function loadExamList(data) {
if (global_cid == null) { if (global_cid == null) {
global_cid = "u-"+global_uid; global_cid = "u-" + global_uid;
} }
} }
@@ -1255,6 +1255,7 @@ async function loadQuestion(n, section = 1, force_reload = false) {
// We chain our db requests as we can only check answers once // We chain our db requests as we can only check answers once
// they have been loaded (should probably use then or after) // they have been loaded (should probably use then or after)
console.log("Load rapid answers")
db.answers db.answers
.get({ .get({
aid: aid, aid: aid,
@@ -1281,7 +1282,7 @@ async function loadQuestion(n, section = 1, force_reload = false) {
console.log("DB", cid, eid, qid); console.log("DB", cid, eid, qid);
console.log("error-", error); console.log("error-", error);
}) })
.then( //.then(function() {
db.answers db.answers
.get({ .get({
aid: aid, aid: aid,
@@ -1300,7 +1301,7 @@ async function loadQuestion(n, section = 1, force_reload = false) {
.catch(function(error) { .catch(function(error) {
console.log("error-", error); console.log("error-", error);
}) })
); //});
addFlagEvents(); addFlagEvents();
loadFlagsFromDb(qid, "1"); loadFlagsFromDb(qid, "1");
@@ -1937,7 +1938,7 @@ function reviewQuestions() {
(n + 1) + (n + 1) +
":</a> <span>Not answered</span></li>" ":</a> <span>Not answered</span></li>"
); );
$("#review-answer-list a").click(function(evt) { $(`#review-answer-list a[data-qid=${n}]`).click(function(evt) {
loadQuestion(this.dataset.qid); loadQuestion(this.dataset.qid);
$("#review-overlay").hide(); $("#review-overlay").hide();
}); });
@@ -2158,7 +2159,7 @@ function reviewQuestions() {
*/ */
function markAnswer(qid, current_question, n) { function markAnswer(qid, current_question, n) {
const type = current_question.type; const type = current_question.type;
//console.log("Mark", current_question); console.log("Mark", current_question);
let option = null; let option = null;
if (review_mode == true) { if (review_mode == true) {
@@ -2218,6 +2219,7 @@ function markAnswer(qid, current_question, n) {
}) })
.toArray() .toArray()
.then(function(saved_user_answers) { .then(function(saved_user_answers) {
//console.log("saved user answers", saved_user_answers)
// check if given answer matches a user saved answer // check if given answer matches a user saved answer
if (saved_user_answers != undefined) { if (saved_user_answers != undefined) {
//console.log(saved_user_answers); //console.log(saved_user_answers);
@@ -2289,7 +2291,7 @@ function markAnswer(qid, current_question, n) {
} }
function addFeedback(current_question, qid) { function addFeedback(current_question, qid) {
//console.log(current_question); console.log(current_question);
if ( if (
current_question.hasOwnProperty("feedback") && current_question.hasOwnProperty("feedback") &&
current_question.feedback.length > 0 current_question.feedback.length > 0