feat: Re-Add a vocabulary item if its incorrect

This commit is contained in:
Alexander Polynomdivision 2018-09-15 17:04:45 +02:00
parent 1200e0e3eb
commit 18c13c06cd

View File

@ -89,7 +89,7 @@ export default class ReviewPage extends React.Component<IProps, IState> {
};
}
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<IProps, IState> {
// 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<IProps, IState> {
render() {
const { question, qtype } = this.state.current;
const questionTitle = `${question} (${reviewQTypeToStr(qtype)})`;
return <div>
{
this.state.toSummary ? (