feat: repariere initialTotalDue in SRS-Sitzung bei ungültigen Werten und verbessere Fehlerbehandlung
All checks were successful
Deploy to production / deploy (push) Successful in 2m1s
All checks were successful
Deploy to production / deploy (push) Successful in 2m1s
This commit is contained in:
@@ -533,6 +533,15 @@ export default {
|
|||||||
this.wrongCount = Number(this.srsSession.wrongCount || 0) || 0;
|
this.wrongCount = Number(this.srsSession.wrongCount || 0) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the stored session has an invalid initialTotalDue (e.g. 0), repair it from server/pool data.
|
||||||
|
if (this.srsSession && (!Number.isFinite(Number(this.srsSession.initialTotalDue)) || Number(this.srsSession.initialTotalDue) <= 0)) {
|
||||||
|
const repairedTotal = Number.isFinite(Number(this.srsServerTotalDue)) && Number(this.srsServerTotalDue) > 0 ? Number(this.srsServerTotalDue) : dueIds.length;
|
||||||
|
try { console.debug('[VocabPracticeDialog] repair srsSession.initialTotalDue', { before: this.srsSession.initialTotalDue, repairedTotal }); } catch (_) {}
|
||||||
|
this.srsSession.initialTotalDue = repairedTotal;
|
||||||
|
this.srsSession.initialDueIds = Array.isArray(this.srsSession.initialDueIds) && this.srsSession.initialDueIds.length ? this.srsSession.initialDueIds : dueIds;
|
||||||
|
try { this.saveSrsSession(); } catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
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 {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user