fix(vocab): use authoritative hard vocabulary pool
All checks were successful
Deploy to production / deploy (push) Successful in 3m15s
All checks were successful
Deploy to production / deploy (push) Successful in 3m15s
This commit is contained in:
@@ -445,7 +445,10 @@ export default {
|
|||||||
maybeFinishHardPhase() {
|
maybeFinishHardPhase() {
|
||||||
if (!this.hardPhaseActive && !this.closeOnHardCompletion) return false;
|
if (!this.hardPhaseActive && !this.closeOnHardCompletion) return false;
|
||||||
if (this.hardRemainingCount > 0) 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();
|
this.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -610,11 +613,21 @@ export default {
|
|||||||
});
|
});
|
||||||
this.loadHardVocabMap();
|
this.loadHardVocabMap();
|
||||||
if (Array.isArray(initialHardPool)) {
|
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) => {
|
initialHardPool.forEach((item) => {
|
||||||
const key = this.getHardKey(item);
|
const key = this.getHardKey(item);
|
||||||
if (!key || !item?.learning || !item?.reference) return;
|
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.
|
// This dialog is explicitly opened for the hard-vocabulary collection.
|
||||||
// Its correct answers must therefore count towards releasing those items
|
// Its correct answers must therefore count towards releasing those items
|
||||||
|
|||||||
Reference in New Issue
Block a user