Study streak system#16
Merged
Merged
Conversation
added 8 commits
June 5, 2026 11:40
Add a 🔥 chip to the Today TopAppBar (hidden when streak is 0) and a StreakBadge composable to the session-complete summary (with "Longest" line when applicable). Previews updated to exercise both surfaces.
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
Sub-project 2 of 2 for the streak system. Adds a daily study streak (consecutive days with ≥1 review) to the "Today" home header and the session-complete summary, derived purely from the review logs persisted in sub-project 1.
StreakCalculator(current + longest from civil-day indices) + a DST-safelocalEpochDaybucketing helper (Calendar-based — minSdk 24 rules outjava.time; the civil-day trick keeps 23h/25h DST days from breaking a streak).StreakProvider:observeStreak()(live, reactive) for the home header;streakIncludingToday()(race-proof vs. the fire-and-forget log append) for the post-session summary.StudyQueueViewModel(outer-combine, leaving the existing aggregation untouched) +StudyViewModel; a 🔥 chip in the Today header and a streak badge in the summary's reserved slot.Test plan
StreakCalculatorTest(rules: empty, only-today, consecutive, alive-through-yesterday, missed-day reset, longest-persists) +DayBucketingTest(same-day, consecutive, DST spring-forward).StreakProviderTest— consecutive days, empty→0,streakIncludingTodayforces today.StudyQueueViewModelTest— livecurrentStreakfrom fake logs; existing aggregation tests untouched.StudyViewModelTest— finishing a real session setscurrentStreak == 1; empty-queue session does NOT fabricate today (regression test for the must-fix below).:app:assembleDebugBUILD SUCCESSFUL; screens compile-verified + previews.Notes
Final holistic review caught one bug:
load()'s empty-queue path reused the "force today" streak read, which could fabricate a streak just from opening a deck with nothing due. Fixed — the empty-queue path now uses the real (non-synthetic) streak; only a finished review forces today. Regression test added.🤖 Generated with Claude Code