From dc178c05c3ab7ce455d069dce60315a66d0b80be Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philip.kaludercic@fau.de>
Date: Sun, 21 Jan 2024 19:44:14 +0000
Subject: [PATCH] Display how many times a question has been presented

---
 quiz.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/quiz.js b/quiz.js
index 0599983..d0e1d66 100644
--- a/quiz.js
+++ b/quiz.js
@@ -7,7 +7,7 @@
  * http://creativecommons.org/publicdomain/zero/1.0/. */
 
 "use strict";
-const version = "$Id: quiz.js,v 1.26 2024/01/21 19:33:05 oj14ozun Exp oj14ozun $";
+const version = "$Id: quiz.js,v 1.27 2024/01/21 19:34:22 oj14ozun Exp oj14ozun $";
 
 const js_version  = document.getElementById("js-version");
 js_version.innerText = version;
@@ -25,6 +25,8 @@ const stats       = document.getElementById("stats");
 const report      = document.getElementById("report");
 const correct     = document.getElementById("correct");
 const wrong       = document.getElementById("wrong");
+const seen        = document.getElementById("seen");
+const total       = document.getElementById("total");
 const perma       = document.getElementById("perma");
 
 const class_list  = document.documentElement.classList;
@@ -65,6 +67,8 @@ function update_stats(q) {
     // update stats
     correct.innerText = data.right;
     wrong.innerText = data.wrong;
+    seen.innerText = (Object.keys(progress).length || 0) +
+        (progress.hasOwnProperty(q.id) ? 0 : 1);
 }
 
 function remember(q, ok) {
@@ -274,6 +278,8 @@ async function make_quiz(file) {
     questions  = await (await fetch(file)).json();
     shuf(questions);
 
+    total.innerText = questions.length;
+
     // when done, load first question
     next();
 };
-- 
GitLab