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 = `

${todo[1].Q}

` + form.children.question.value = todo[1].Q let clues = "" for (var i in todo[1].Clues) { clues += `
clue #${i}${todo[1].Clues[i]}
` } form.children.clues.innerHTML = clues + form.children.clues.value = todo[1].Clues let solution = "" for (var i in todo[1].Solution) { @@ -65,6 +93,7 @@ solution = `
solution${solution}
` } form.children.solution.innerHTML = solution + form.children.solution.value = todo[1].Solution } nextQuestion(document.getElementById("flash"))