Skip to content
Snippets Groups Projects
Commit dc178c05 authored by Philip Kaluđerčić's avatar Philip Kaluđerčić :u7121:
Browse files

Display how many times a question has been presented

parent 8dfda9b0
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/. */ * http://creativecommons.org/publicdomain/zero/1.0/. */
"use strict"; "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"); const js_version = document.getElementById("js-version");
js_version.innerText = version; js_version.innerText = version;
...@@ -25,6 +25,8 @@ const stats = document.getElementById("stats"); ...@@ -25,6 +25,8 @@ const stats = document.getElementById("stats");
const report = document.getElementById("report"); const report = document.getElementById("report");
const correct = document.getElementById("correct"); const correct = document.getElementById("correct");
const wrong = document.getElementById("wrong"); const wrong = document.getElementById("wrong");
const seen = document.getElementById("seen");
const total = document.getElementById("total");
const perma = document.getElementById("perma"); const perma = document.getElementById("perma");
const class_list = document.documentElement.classList; const class_list = document.documentElement.classList;
...@@ -65,6 +67,8 @@ function update_stats(q) { ...@@ -65,6 +67,8 @@ function update_stats(q) {
// update stats // update stats
correct.innerText = data.right; correct.innerText = data.right;
wrong.innerText = data.wrong; wrong.innerText = data.wrong;
seen.innerText = (Object.keys(progress).length || 0) +
(progress.hasOwnProperty(q.id) ? 0 : 1);
} }
function remember(q, ok) { function remember(q, ok) {
...@@ -274,6 +278,8 @@ async function make_quiz(file) { ...@@ -274,6 +278,8 @@ async function make_quiz(file) {
questions = await (await fetch(file)).json(); questions = await (await fetch(file)).json();
shuf(questions); shuf(questions);
total.innerText = questions.length;
// when done, load first question // when done, load first question
next(); next();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment