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
*.sw?
houhou.db
houhou.db
src/data/kanadata.json

View file

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