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

Simplify progress data

parent 21936fb0
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
// ./LICENSE for more details.
"use strict";
const version = "$Id: quiz.js,v 1.10 2024/01/15 19:25:55 oj14ozun Exp oj14ozun $";
const version = "$Id: quiz.js,v 1.11 2024/01/15 19:31:13 oj14ozun Exp oj14ozun $";
const answers = document.getElementById("answers");
const text = document.getElementById("text");
......@@ -37,7 +37,7 @@ function shuf(arr) { // shuffle arr using Fisher–Yates
}
function get_data(q) {
return progress[q.id] || { "right": 0, "wrong": 0, "count": 0 };;
return progress[q.id] || { "right": 0, "wrong": 0 };
}
function evaluate(q) {
......@@ -50,10 +50,8 @@ function update_stats(q) {
// update stats
stats.innerHTML =
"<abbr title=\"Wie oft gesehen\">n</abbr> = " + data.count
+ ", <abbr title=\"Wie oft richtig\">r</abbr> = " + data.right
+ ", <abbr title=\"Wie oft falsch\">f</abbr> = " + data.wrong
+ "; <abbr title=\"Anzahl an Fragen insgesammt\">#</abbr> = " + questions.length;
"<abbr title=\"Wie oft richtig\">" + data.right + "</abbr>:"
+ "<abbr title=\"Wie oft falsch\">" + data.wrong + "</abbr>";
}
function remember(q, ok) {
......@@ -64,7 +62,6 @@ function remember(q, ok) {
} else {
data["wrong"]++;
}
data["count"]++;
progress[q.id] = data;
window.sessionStorage.setItem("progress", progress);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment