score and other bugs fixed

This commit is contained in:
LinlyBoi
2023-12-05 08:28:24 +02:00
parent de1f8b35e3
commit cca89e3003

View File

@@ -5,6 +5,7 @@ function nameSubmit() {
name: sName, name: sName,
id: sId, id: sId,
startTime: new Date(), startTime: new Date(),
score: 0,
}; };
localStorage.setItem("studData", JSON.stringify(studData)); localStorage.setItem("studData", JSON.stringify(studData));
var privacyViolation = document.getElementById("privacyViolation"); var privacyViolation = document.getElementById("privacyViolation");
@@ -97,7 +98,7 @@ const questions = [
generateQuestion(3, 7, 2, 7, 14, 21), generateQuestion(3, 7, 2, 7, 14, 21),
generateQuestion(6, 6, 36, 6, 14, 21), generateQuestion(6, 6, 36, 6, 14, 21),
] ]
console.log(questions); console.log(questions[0].answers);
function setQ(n) { function setQ(n) {
var question = document.getElementById("question") var question = document.getElementById("question")
@@ -110,9 +111,10 @@ function setQ(n) {
} }
} }
var questionCounter = 0; var questionCounter = 1;
setQ(questionCounter);
function nextQ() { function nextQ() {
if (questionCounter < questions.length) if (questionCounter < questions.length - 1)
questionCounter++; questionCounter++;
setQ(questionCounter); setQ(questionCounter);
if (questionCounter < questions.length) if (questionCounter < questions.length)