From 74c9c040c0bd066b815ad718cd6bd97cacd26582 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 5 Oct 2026 10:58:16 +0200 Subject: [PATCH] fix(vocab): use authoritative hard vocabulary pool --- .../socialnetwork/VocabPracticeDialog.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue index edb26af..b94c8ec 100755 --- a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue +++ b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue @@ -445,7 +445,10 @@ export default { maybeFinishHardPhase() { if (!this.hardPhaseActive && !this.closeOnHardCompletion) return false; if (this.hardRemainingCount > 0) return false; - if (this.hardCount <= 0 && this.closeOnHardCompletion) { + // In the dedicated hard-vocabulary dialog, completion is determined by + // the supplied server list. Stale localStorage entries must not keep the + // dialog open after every actual hard item was cleared. + if (this.closeOnHardCompletion) { this.close(); return true; } @@ -610,11 +613,21 @@ export default { }); this.loadHardVocabMap(); if (Array.isArray(initialHardPool)) { + // The course view fetched this list from the SRS endpoint immediately + // before opening. It is authoritative; do not merge old local entries + // into it, otherwise the displayed count can exceed the real open set. + const authoritativeHardMap = {}; initialHardPool.forEach((item) => { const key = this.getHardKey(item); if (!key || !item?.learning || !item?.reference) return; - this.hardVocabMap[key] = { learning: item.learning, reference: item.reference, itemKey: item.itemKey || item.id || null }; + authoritativeHardMap[key] = { + learning: item.learning, + reference: item.reference, + itemKey: item.itemKey || item.id || null + }; }); + this.hardVocabMap = authoritativeHardMap; + this.saveHardVocabMap(); } // This dialog is explicitly opened for the hard-vocabulary collection. // Its correct answers must therefore count towards releasing those items