From 18c13c06cdd068ee43829bf9d3ed7bb4bffb4d83 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Sat, 15 Sep 2018 17:04:45 +0200 Subject: [PATCH] feat: Re-Add a vocabulary item if its incorrect --- src/pages/review.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/review.tsx b/src/pages/review.tsx index ad0d7a0..7c2ddcc 100644 --- a/src/pages/review.tsx +++ b/src/pages/review.tsx @@ -89,7 +89,7 @@ export default class ReviewPage extends React.Component { }; } - currentVocab = (id: number) => { + vocabFromId = (id: number) => { return this.vocab.find((el) => el.id === this.state.current.id); } @@ -124,6 +124,16 @@ export default class ReviewPage extends React.Component { // TODO: Show a hint console.log("Partially correct"); } else { + // Find the IVocab item + const vocab = this.vocabFromId(this.state.current.id); + if (vocab) { + // Re-Add the vocabulary item to the review queue + // TODO: Only re-add when it when it's not re-queued + vocabToReviewCard(vocab).forEach(this.reviewQueue.enqueue); + } else { + console.log("[ReviewPage::checkInput] Could not find IVocab item for wrong IReviewCard"); + } + this.setState({ popoverOpen: true, popoverText: "Das war nicht richtig", @@ -139,6 +149,7 @@ export default class ReviewPage extends React.Component { render() { const { question, qtype } = this.state.current; const questionTitle = `${question} (${reviewQTypeToStr(qtype)})`; + return
{ this.state.toSummary ? (