Real-time study queue updates#12
Merged
Merged
Conversation
added 5 commits
June 4, 2026 22:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The study-queue surfaces computed card "dueness" as
fsrsDue <= now()inside acombine { }block, which only re-runs when an upstream Flow emits. A card becoming due is pure wall-clock time crossing a threshold — no data changes at that instant — so the counts went stale until some unrelated event (an edit, a sync, or re-subscription) forced a recompute. This PR makes time itself a reactive input so the queue refreshes the exact moment a card becomes due, with no data change, navigation, or restart.core/domain/fsrs/DueTicker.kt→Flow<List<Card>>.withDueTicks(now): pairs each card list with anowtimestamp re-emitted precisely at the soonest futurefsrsDue(event-driven viaflatMapLatest+delay). Reschedules on card changes; idles (no busy-wait) when nothing is future-due;flatMapLatestcancels the pending wait whenWhileSubscribedunsubscribes (zero background wakeups).StudyQueueViewModel(Today/Queue home) andDeckDetailViewModel(deck Due/New stats + the Study ↔ "You're all caught up!" slot) now feed their cards flow through the operator and consume the reactivenowMillis.Out of scope: the active study session stays a fixed snapshot;
studiedTodaymidnight rollover; OS background/notification refresh.Test plan
DueTickerTest(6 JVM tests, Turbine + virtual time): immediate emit + idle on no-future-due; re-emit exactly when a future Review card becomes due; soonest-then-next ordering; Learning-state watched; deleted card ignored; restart on card-list change.StudyQueueViewModelTest+LibraryAndDeckDetailViewModelTest: a near-future card starts uncounted, then appears indueCount/readyCountafter virtual time advances past its due moment.:app:assembleDebugBUILD SUCCESSFUL.🤖 Generated with Claude Code