Add current and longest streak to menu - #5
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
Compute current streak (consecutive days with totalCount > 0, ending today or yesterday if today is empty) and longest streak (best run ever, with the date it ended) from existing SyncData. Show as two new menu items right after the existing Record line. The longest streak line is hidden when it equals the current streak to avoid duplicate display. - Sources/Models.swift: new currentStreak(from:) and longestStreak() on SyncData - Sources/AppDelegate.swift: getStats() returns the new fields; rebuildMenu() renders the two lines with the redundancy guard No schema change. Pure read from existing dailyCounts.
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.
Adds current and longest typing streak to the menu, slotting right after the
existing Record line.
SyncData.currentStreak(from:)— consecutive days ending today (oryesterday if today is empty yet) with
totalCount > 0SyncData.longestStreak()— best run ever, with the date it endedrebuildMenu()shows the current streak, and only shows longest when itexceeds current (avoids duplicate display)
Computed on the fly from existing
dailyCounts— no schema change. Pairswith the existing
Recordline as the natural twin metric. Two newisEnabled = falserows; no new screen real estate beyond the menu.The demo uses a synthesized 60-day dataset (13-day current streak, 27-day
historical longest) since dev builds run ad-hoc-signed without iCloud
entitlements; the code paths are exercised against the same
SyncDataAPIthe production app uses.
AI was used for assistance.