diff --git a/public/root.html b/public/root.html index c3ffcce..3dfd495 100644 --- a/public/root.html +++ b/public/root.html @@ -16,14 +16,15 @@
- @@ -35,10 +36,35 @@ map((key) => [ [key, knowledgebase[key]] ]) + console.log(0, knowledgebase) + + function passQuestion(form) { + 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) + knowledgebase.push([[ + form.children.idq.value, + { + Q: form.children.question.value, + Clues: form.children.clues.value, + Solution: form.children.solution.value, + }, + ]]) + console.log(2, knowledgebase) + nextQuestion(form) + } + + function pushAnswer(idq, answer, passed) { + console.log(idq, answer, passed) + } function nextQuestion(form) { form.children.answer.value = "" - let todo = knowledgebase.pop() + let todo = knowledgebase.shift() if (!todo) { todo = [0] } @@ -50,12 +76,14 @@ form.children.idq.value = todo[0] form.children.question.innerHTML = `