diff options
| author | Claude <noreply@anthropic.com> | 2026-02-02 12:22:03 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-02-02 12:22:03 +0000 |
| commit | d4489f24a05911d1395e8473fe86c3442d9397ee (patch) | |
| tree | 3f302c9c531c7ba25e2c5ad74c44b086df03a0d7 /src/client/db/repositories.ts | |
| parent | c20922a1aa339e34b4bed3747222f4b9d9941cd6 (diff) | |
| download | kioku-d4489f24a05911d1395e8473fe86c3442d9397ee.tar.gz kioku-d4489f24a05911d1395e8473fe86c3442d9397ee.tar.zst kioku-d4489f24a05911d1395e8473fe86c3442d9397ee.zip | |
fix(study): use date-based comparison with 3 AM boundary for due cards
Instead of comparing due timestamps exactly (card.due <= now), compare
against the next 3 AM boundary so all cards due within the current
study day appear at once. This prevents new cards from trickling in
throughout the day when FSRS fuzz spreads due times.
https://claude.ai/code/session_01FeDztLcyGofd6nxh8ct7a3
Diffstat (limited to 'src/client/db/repositories.ts')
| -rw-r--r-- | src/client/db/repositories.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/db/repositories.ts b/src/client/db/repositories.ts index e01254e..5121bae 100644 --- a/src/client/db/repositories.ts +++ b/src/client/db/repositories.ts @@ -1,4 +1,5 @@ import { v4 as uuidv4 } from "uuid"; +import { getEndOfStudyDayBoundary } from "../../shared/date"; import { CardState, db, @@ -140,11 +141,11 @@ export const localCardRepository = { * Get due cards for a deck */ async findDueCards(deckId: string, limit?: number): Promise<LocalCard[]> { - const now = new Date(); + const boundary = getEndOfStudyDayBoundary(); const query = db.cards .where("deckId") .equals(deckId) - .filter((card) => card.deletedAt === null && card.due <= now); + .filter((card) => card.deletedAt === null && card.due < boundary); const cards = await query.toArray(); // Sort by due date ascending |
