This commit is contained in:
Ross
2021-04-18 11:35:02 +01:00
parent fdfb6a5f80
commit 9417850f31
+3 -3
View File
@@ -234,17 +234,17 @@ async function loadExamList(data) {
// If the timestamps differ delete and force a refresh // If the timestamps differ delete and force a refresh
const exam_timestamp = exam_generated_map[saved_exam.eid][0]; const exam_timestamp = exam_generated_map[saved_exam.eid][0];
const question_timestamp_hash = exam_generated_map[saved_exam.eid][1]; const question_timestamp_hash = exam_generated_map[saved_exam.eid][1];
console.log("comp timestamps", exam_timestamp, saved_exam.generated)
console.log(exam_generated_map)
if ( if (
Date.parse(saved_exam.generated) != Date.parse(saved_exam.generated) !=
// Probably better doing this serveside
Date.parse(exam_timestamp.split("+")[0]) Date.parse(exam_timestamp.split("+")[0])
) { ) {
question_db.saved_exams.where("eid").equals(saved_exam.eid).delete(); question_db.saved_exams.where("eid").equals(saved_exam.eid).delete();
$(`li.cache-item[data-eid="${saved_exam.eid}"]`).addClass( $(`li.cache-item[data-eid="${saved_exam.eid}"]`).addClass(
"cache-out-of-date" "cache-out-of-date"
); ).appendChild(`(latest: ${exam_timestamp}`);
} else { } else {
$(`.packet-button[data-eid="${saved_exam.eid}"]`).addClass("cached"); $(`.packet-button[data-eid="${saved_exam.eid}"]`).addClass("cached");
} }