feat: verbessere SRS-Logik mit Fallback-Mechanismus und Debug-Ausgaben für die Initialisierung
All checks were successful
Deploy to production / deploy (push) Successful in 2m0s
All checks were successful
Deploy to production / deploy (push) Successful in 2m0s
This commit is contained in:
@@ -535,6 +535,20 @@ export default {
|
|||||||
|
|
||||||
const doneSet = new Set(Array.isArray(this.srsSession.doneIds) ? this.srsSession.doneIds : []);
|
const doneSet = new Set(Array.isArray(this.srsSession.doneIds) ? this.srsSession.doneIds : []);
|
||||||
this.srsQueueIds = dueIds.filter((id) => !doneSet.has(id));
|
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();
|
this.saveSrsSession();
|
||||||
},
|
},
|
||||||
open({ languageId, chapterId, lessonId, courseId, initialPool = null, srsMode = false, onClose = null }) {
|
open({ languageId, chapterId, lessonId, courseId, initialPool = null, srsMode = false, onClose = null }) {
|
||||||
@@ -572,6 +586,10 @@ export default {
|
|||||||
document.addEventListener('keydown', this.handleKeyDown);
|
document.addEventListener('keydown', this.handleKeyDown);
|
||||||
});
|
});
|
||||||
this.loadHardVocabMap();
|
this.loadHardVocabMap();
|
||||||
|
// Expose instance for temporary debugging in browser console
|
||||||
|
try {
|
||||||
|
window.__vocabPracticeDialog = this;
|
||||||
|
} catch (_) {}
|
||||||
this.reloadPool();
|
this.reloadPool();
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
|||||||
Reference in New Issue
Block a user