fix(vocab): use authoritative hard vocabulary pool
All checks were successful
Deploy to production / deploy (push) Successful in 3m15s

This commit is contained in:
Torsten Schulz (local)
2026-10-05 10:58:16 +02:00
parent 042fd96bed
commit 74c9c040c0

View File

@@ -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