Skip to content

Commit

Permalink
bugfixes in rekendoos
Browse files Browse the repository at this point in the history
  • Loading branch information
glendc committed Feb 7, 2024
1 parent b203362 commit d5c3ab2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions site/1/rekendoos.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
display: inline-block;
text-align: center;
}

input.split-part {
text-align: center;
line-height: 1.75em;
Expand Down Expand Up @@ -100,7 +101,7 @@ <h1>rekendoos <code>➕➖🟰</code></h1>
</p>
<form id="form-setup" , action="javascript:void(0)">
<label for="count-until">Tot hoeveel kan het kind al tellen?</label>
<input type="number" id="count-until" name="count-until" min="10" max="100" value="10" required><br>
<input type="number" id="count-until" name="count-until" min="3" max="100" value="10" required><br>

<label for="num-exercises">Hoeveel oefeningen wenst u te doen?</label>
<input type="number" id="num-exercises" name="num-exercises" min="1" max="100" value="10" required><br>
Expand Down Expand Up @@ -154,6 +155,11 @@ <h3 id="form-title"></h3>
console.log("numExercises", numExercises);
console.log("exercises", exercises);

if (exercises.length === 0) {
alert("Gelieve minstens één soort oefening te selecteren.");
return;
}

let exerciseCount = 0;
let exercise = {};
let wrongExercises = [];
Expand Down Expand Up @@ -244,11 +250,11 @@ <h3 id="form-title"></h3>
const answerContext = document.getElementById("answer-context") ? document.getElementById("answer-context").value : "answer";

if (answer == exercise[answerContext]) {
document.getElementById("exercise-feedback").hidden = true;

if (exerciseCount < numExercises) {
console.log(answer, "correct, next exercise");
generateExercise();
} else {
console.log(answer, "correct, done");
document.getElementById("exercise").hidden = true;
document.getElementById("exercise-feedback").hidden = false;
const feedback = document.getElementById("exercise-feedback");
Expand All @@ -265,6 +271,8 @@ <h3 id="form-title"></h3>
}
}
} else {
console.log(answer, "wrong, try again");

document.getElementById("exercise-feedback").innerHTML = `❌ Fout, probeer het nog eens.`;
document.getElementById("exercise-feedback").hidden = false;

Expand All @@ -287,6 +295,7 @@ <h3 id="form-title"></h3>
if (!wrongExercises.includes(exerciseString)) {
wrongExercises.push(exerciseString);
}
document.getElementById("exercise").hidden = false;
}
}

Expand Down

0 comments on commit d5c3ab2

Please sign in to comment.