From caabff5f5ee821a0c77e04e48d4987cea852a4b5 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 28 Sep 2026 14:13:37 +0200 Subject: [PATCH] feat(vocab): update SRS session storage version to v3 and improve session handling --- .../socialnetwork/VocabPracticeDialog.vue | 4 +++- frontend/src/views/social/VocabCourseView.vue | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue index 2d264f6..0f986dc 100755 --- a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue +++ b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue @@ -141,7 +141,9 @@ import { normalizeComparableWithNumberWords } from '@/utils/numberAnswerVariants const PRACTICE_MIN_EXPOSURES = 3; // The original daily batch remains stable when the dialog is reopened. -const SRS_SESSION_STORAGE_VERSION = 2; +// Keep in sync with VocabCourseView. v3 discards legacy empty sessions that +// could block cards due later on the same calendar day. +const SRS_SESSION_STORAGE_VERSION = 3; const HARD_REQUIRED_CONSECUTIVE_CORRECT = 5; const MAX_DAILY_DUE = 50; const MAX_DAILY_HARD_VOCABS = 7; diff --git a/frontend/src/views/social/VocabCourseView.vue b/frontend/src/views/social/VocabCourseView.vue index acd2bc8..bb727fc 100755 --- a/frontend/src/views/social/VocabCourseView.vue +++ b/frontend/src/views/social/VocabCourseView.vue @@ -375,7 +375,9 @@ import { confirmAction, showApiError, showInfo, showSuccess } from '@/utils/feed import VocabPracticeDialog from '@/dialogues/socialnetwork/VocabPracticeDialog.vue'; import { localizeVocabCourseTitle } from '@/utils/vocabCourseTitle.js'; -const SRS_SESSION_STORAGE_VERSION = 2; +// v3 invalidates old empty daily sessions. Those could be created before a +// scheduled card became visible and then incorrectly hide today's due batch. +const SRS_SESSION_STORAGE_VERSION = 3; export default { name: 'VocabCourseView', @@ -600,6 +602,16 @@ export default { return; } const total = Math.max(0, Number(session.initialTotalDue) || 0); + // A session with no originally scheduled cards must not take + // precedence over cards that are now due. This happened when the + // page was opened before the old time-of-day threshold and kept a + // zero-card session for the rest of the calendar day. + if (total === 0 && this.srsDueItems.length > 0) { + localStorage.removeItem(key); + this.srsTodayRemaining = null; + this.srsTodayQuota = null; + return; + } const initialIds = new Set(Array.isArray(session.initialDueIds) ? session.initialDueIds : []); const done = new Set((Array.isArray(session.doneIds) ? session.doneIds : []) .filter((id) => initialIds.has(id))).size;