From 6d80475d4d211a567562bbff610a020b4bbddf03 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 4 Aug 2021 19:27:46 +0100 Subject: [PATCH] . --- js/main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/main.js b/js/main.js index 1c5f370..3366112 100644 --- a/js/main.js +++ b/js/main.js @@ -271,13 +271,14 @@ async function loadExamList(data) { // If a single question is out of date we invalidate the lot... const q_object = { qid: String(q), type: saved_exam.exam_type }; console.log(q_object); - question_db.question_data - .get(q_object) - .then((d) => { + + let save_question_data = await question_db.question_data.get(q_object); + + try { console.log("saved question data", d, new_question_json_id) - // d is undefined if the question is not saved + // saved_question_data is undefined if the question is not saved // we should really just requeue the required question for dowload... - if (d == undefined || d.data.question_json_id != new_question_json_id) { + if (saved_question_data == undefined || saved_question_data.data.question_json_id != new_question_json_id) { $(`li.cache-item[data-eid="${saved_exam.eid}"]`).addClass( "cache-out-of-date" ); @@ -295,8 +296,7 @@ async function loadExamList(data) { .delete(); } d = null; - }) - .catch((e) => { + } catch(e) { console.log("Error loading qusetion data", q_object); console.log(e); console.log("1234", saved_exam.eid); @@ -316,7 +316,7 @@ async function loadExamList(data) { .where(["qid", "type"]) .equals([String(q), saved_exam.exam_type]) .delete(); - }); + } } } });