add incorrect items to the end of the queue

This commit is contained in:
Michael Zhang 2023-06-11 15:08:19 -05:00
parent f87230596d
commit 492215d17c
2 changed files with 6 additions and 2 deletions

3
.gitignore vendored
View file

@ -23,4 +23,5 @@ dist-ssr
*.sln *.sln
*.sw? *.sw?
houhou.db houhou.db
src/data/kanadata.json

View file

@ -83,6 +83,9 @@ export function Component() {
// Check the answer // Check the answer
if (!possibleAnswers.has(currentAnswer)) { if (!possibleAnswers.has(currentAnswer)) {
setIsIncorrect(true); setIsIncorrect(true);
const lastItem = reviewQueue[reviewQueue.length - 1];
if (!_.isEqual(lastItem, nextItem)) setReviewQueue([...reviewQueue, nextItem]);
return; return;
} }
@ -90,7 +93,7 @@ export function Component() {
setAnyProgress(true); setAnyProgress(true);
setIsIncorrect(false); setIsIncorrect(false);
setCurrentAnswer(""); setCurrentAnswer("");
const [_, ...rest] = reviewQueue; const [_currentItem, ...rest] = reviewQueue;
setReviewQueue(rest); setReviewQueue(rest);
}; };