feat(VocabPracticeDialog): implement immediate retry feature for incorrect answers
All checks were successful
Deploy to production / deploy (push) Successful in 1m47s

- Added a `pendingRetry` property to manage immediate retries after incorrect answers, enhancing user experience during vocabulary practice.
- Updated logic to handle retries, allowing users to quickly attempt the last question again with the correct direction.
- Ensured that the retry state is reset appropriately after correct answers or when skipping questions, maintaining clarity in the training flow.
This commit is contained in:
Torsten Schulz (local)
2026-04-20 10:02:32 +02:00
parent 1500f01875
commit 8ce15441bf

View File

@@ -178,6 +178,7 @@ export default {
// current question
current: null, // { id, learning, reference }
direction: 'L2R', // L2R: learning->reference, R2L: reference->learning
pendingRetry: null, // { id, direction } for immediate retry after wrong answers
acceptableAnswers: [],
submittedAnswer: '',
lastWrongReview: null,
@@ -378,6 +379,7 @@ export default {
this.perId = {};
this.lastIds = [];
this.lastWrongReview = null;
this.pendingRetry = null;
this.pool = [];
this.locked = false;
this.resetQuestion();
@@ -659,6 +661,13 @@ export default {
if (!nextId) return null;
return items.find((it) => it.id === nextId) || null;
}
if (this.pendingRetry?.id) {
const retryItem = items.find((it) => it.id === this.pendingRetry.id);
if (retryItem) {
return retryItem;
}
this.pendingRetry = null;
}
const recent = new Set(this.lastIds);
const underexposed = items
.map((item) => {
@@ -749,6 +758,7 @@ export default {
if (isCorrect) {
this.correctCount += 1;
this.lastWrongReview = null;
this.pendingRetry = null;
} else {
this.wrongCount += 1;
const answers = this.visibleCorrectAnswers.length > 0
@@ -759,6 +769,12 @@ export default {
submittedAnswer: this.submittedAnswer,
answers
};
if (!this.srsMode && this.current?.id) {
this.pendingRetry = {
id: this.current.id,
direction: this.direction
};
}
}
if (!this.srsMode) {
this.reportSrsReview(isCorrect);
@@ -836,6 +852,7 @@ export default {
}
},
skip() {
this.pendingRetry = null;
this.next();
},
next() {
@@ -851,7 +868,11 @@ export default {
this.resetQuestion();
return;
}
const retryDirection = this.pendingRetry?.direction || null;
this.resetQuestion();
if (retryDirection) {
this.direction = retryDirection;
}
this.current = this.pickNextItem();
if (!this.current) return;
const prompt = this.currentPrompt;