fix(vocab): never hide due batch behind zero quota
All checks were successful
Deploy to production / deploy (push) Successful in 2m10s
All checks were successful
Deploy to production / deploy (push) Successful in 2m10s
This commit is contained in:
@@ -455,13 +455,16 @@ export default {
|
|||||||
srsDailyCount() {
|
srsDailyCount() {
|
||||||
// A valid current-day session represents the fixed daily batch. Without
|
// A valid current-day session represents the fixed daily batch. Without
|
||||||
// one, the server's due count determines the first batch (max. 50).
|
// one, the server's due count determines the first batch (max. 50).
|
||||||
if (Number.isFinite(Number(this.srsTodayRemaining))) {
|
// A zero-card session is never a valid batch while the server still
|
||||||
|
// reports due items. Otherwise the UI can incorrectly show "0 of 0"
|
||||||
|
// even though there is a backlog to start today.
|
||||||
|
if (this.srsDailyQuota > 0 && Number.isFinite(Number(this.srsTodayRemaining))) {
|
||||||
return Math.max(0, Number(this.srsTodayRemaining));
|
return Math.max(0, Number(this.srsTodayRemaining));
|
||||||
}
|
}
|
||||||
return Math.min(this.srsDueCount, this.srsDailyLimit);
|
return Math.min(this.srsDueCount, this.srsDailyLimit);
|
||||||
},
|
},
|
||||||
srsDailyQuota() {
|
srsDailyQuota() {
|
||||||
if (Number.isFinite(Number(this.srsTodayQuota))) {
|
if (Number.isFinite(Number(this.srsTodayQuota)) && Number(this.srsTodayQuota) > 0) {
|
||||||
return Math.max(0, Number(this.srsTodayQuota));
|
return Math.max(0, Number(this.srsTodayQuota));
|
||||||
}
|
}
|
||||||
return Math.min(this.srsDueCount, this.srsDailyLimit);
|
return Math.min(this.srsDueCount, this.srsDailyLimit);
|
||||||
@@ -1028,7 +1031,10 @@ export default {
|
|||||||
onClose: () => this.refreshHardVocabList()
|
onClose: () => this.refreshHardVocabList()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openSrsPractice() {
|
async openSrsPractice() {
|
||||||
|
// Refresh immediately before opening. The status dialog may have been
|
||||||
|
// opened while a stale empty session was still in local storage.
|
||||||
|
await this.loadSrsDueItems();
|
||||||
if (!this.srsDueItems.length) {
|
if (!this.srsDueItems.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user