func q redo

master
Bel LaPointe 2023-04-07 13:25:40 -06:00
parent 80d987b69e
commit ef25a77254
1 changed files with 20 additions and 6 deletions

View File

@ -25,7 +25,7 @@
<input type="text" name="answer"> <input type="text" name="answer">
<input type="button" value="pass" onclick="passQuestion(this.parentElement)"> <input type="button" value="pass" onclick="passQuestion(this.parentElement)">
<input type="button" value="fail" onclick="failQuestion(this.parentElement)"> <input type="button" value="fail" onclick="failQuestion(this.parentElement)">
<input type="button" value="skip" onclick="nextQuestion(this.parentElement)"> <input type="button" value="skip" onclick="skipQuestion(this.parentElement)">
</form> </form>
</body> </body>
<footer> <footer>
@ -39,23 +39,35 @@
console.log(0, knowledgebase) console.log(0, knowledgebase)
function passQuestion(form) { function passQuestion(form) {
pushAnswer(form.children.idq.value, form.children.answer.value, true) if (!form.children.answer.retake) {
pushAnswer(form.children.idq.value, form.children.answer.value, true)
}
nextQuestion(form) nextQuestion(form)
} }
function failQuestion(form) { function failQuestion(form) {
pushAnswer(form.children.idq.value, form.children.answer.value, false) if (!form.children.answer.retake) {
console.log(1, knowledgebase) pushAnswer(form.children.idq.value, form.children.answer.value, false)
}
queueRedoQuestion(form)
nextQuestion(form)
}
function skipQuestion(form) {
queueRedoQuestion(form)
nextQuestion(form)
}
function queueRedoQuestion(form) {
knowledgebase.push([[ knowledgebase.push([[
form.children.idq.value, form.children.idq.value,
{ {
Q: form.children.question.value, Q: form.children.question.value,
Clues: form.children.clues.value, Clues: form.children.clues.value,
Solution: form.children.solution.value, Solution: form.children.solution.value,
Retake: true,
}, },
]]) ]])
console.log(2, knowledgebase)
nextQuestion(form)
} }
function pushAnswer(idq, answer, passed) { function pushAnswer(idq, answer, passed) {
@ -94,6 +106,8 @@
} }
form.children.solution.innerHTML = solution form.children.solution.innerHTML = solution
form.children.solution.value = todo[1].Solution form.children.solution.value = todo[1].Solution
form.children.answer.retake = todo[1].Retake
} }
nextQuestion(document.getElementById("flash")) nextQuestion(document.getElementById("flash"))