Skip to content

Add current and longest streak to menu - #5

Open
mvanhorn wants to merge 1 commit into
rauchg:mainfrom
mvanhorn:feat/streaks
Open

Add current and longest streak to menu#5
mvanhorn wants to merge 1 commit into
rauchg:mainfrom
mvanhorn:feat/streaks

Conversation

@mvanhorn

Copy link
Copy Markdown

Adds current and longest typing streak to the menu, slotting right after the
existing Record line.

streak demo

  • SyncData.currentStreak(from:) — consecutive days ending today (or
    yesterday if today is empty yet) with totalCount > 0
  • SyncData.longestStreak() — best run ever, with the date it ended
  • rebuildMenu() shows the current streak, and only shows longest when it
    exceeds current (avoids duplicate display)

Computed on the fly from existing dailyCounts — no schema change. Pairs
with the existing Record line as the natural twin metric. Two new
isEnabled = false rows; 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 SyncData API
the production app uses.

AI was used for assistance.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant