diff --git a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue index 0b816d1..2170ba3 100644 --- a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue +++ b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue @@ -535,6 +535,20 @@ export default { const doneSet = new Set(Array.isArray(this.srsSession.doneIds) ? this.srsSession.doneIds : []); this.srsQueueIds = dueIds.filter((id) => !doneSet.has(id)); + try { + console.debug('[VocabPracticeDialog] initSrsSessionFromPool', { courseId: this.openParams?.courseId, dueIdsLen: dueIds.length, srsQueueLen: this.srsQueueIds.length, stored: !!this.srsSession }); + } catch (_) {} + + // Fallback: if SRS mode but queue is empty (e.g. mismatch between stored session and current pool), fall back to pool order + if (this.srsMode && Array.isArray(this.srsQueueIds) && this.srsQueueIds.length === 0) { + const fallbackIds = (this.pool || []).map((it) => it.id).filter(Boolean); + if (fallbackIds.length > 0) { + try { console.debug('[VocabPracticeDialog] initSrsSessionFromPool: srsQueueIds empty, falling back to pool ids', { fallbackLen: fallbackIds.length }); } catch (_) {} + this.srsQueueIds = fallbackIds; + // keep initialTotalDue stable if possible + if (!this.srsSession) this.srsSession = { version: SRS_SESSION_STORAGE_VERSION, dateKey: this.getLocalDateKey(), courseId: this.openParams.courseId, initialTotalDue: fallbackIds.length, initialDueIds: fallbackIds, doneIds: [], correctCount: 0, wrongCount: 0 }; + } + } this.saveSrsSession(); }, open({ languageId, chapterId, lessonId, courseId, initialPool = null, srsMode = false, onClose = null }) { @@ -572,6 +586,10 @@ export default { document.addEventListener('keydown', this.handleKeyDown); }); this.loadHardVocabMap(); + // Expose instance for temporary debugging in browser console + try { + window.__vocabPracticeDialog = this; + } catch (_) {} this.reloadPool(); }, close() {