func q redo
parent
80d987b69e
commit
ef25a77254
|
|
@ -25,7 +25,7 @@
|
|||
<input type="text" name="answer">
|
||||
<input type="button" value="pass" onclick="passQuestion(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>
|
||||
</body>
|
||||
<footer>
|
||||
|
|
@ -39,23 +39,35 @@
|
|||
console.log(0, knowledgebase)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
function failQuestion(form) {
|
||||
pushAnswer(form.children.idq.value, form.children.answer.value, false)
|
||||
console.log(1, knowledgebase)
|
||||
if (!form.children.answer.retake) {
|
||||
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([[
|
||||
form.children.idq.value,
|
||||
{
|
||||
Q: form.children.question.value,
|
||||
Clues: form.children.clues.value,
|
||||
Solution: form.children.solution.value,
|
||||
Retake: true,
|
||||
},
|
||||
]])
|
||||
console.log(2, knowledgebase)
|
||||
nextQuestion(form)
|
||||
}
|
||||
|
||||
function pushAnswer(idq, answer, passed) {
|
||||
|
|
@ -94,6 +106,8 @@
|
|||
}
|
||||
form.children.solution.innerHTML = solution
|
||||
form.children.solution.value = todo[1].Solution
|
||||
|
||||
form.children.answer.retake = todo[1].Retake
|
||||
}
|
||||
|
||||
nextQuestion(document.getElementById("flash"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue