Files
ZenXercise/docs/adr/0006-streak-derived-and-reminders-rescheduled.md
CedricandClaude Opus 5.5 1ffe6269ea Stage 5: History, the shared daily Streak and Reminders
- Streak computed from all complete Sessions: Grace Hour (00:00-01:00
  counts for yesterday unless it is done), a Freeze per 7 Streak Days
  (max 2) spent automatically on a missed day (ADR 0006)
- Top bar flame (grey until today is done) opening a panel with current
  and longest Streak, Freezes and a month calendar; 'Day N of your
  streak' on a fresh summary
- History per Mode grouped by day, reopening each summary
- Two adjustable Reminders (19:00, 22:30) scheduled 14 days ahead with
  flutter_local_notifications, none on a done day; permission asked
  after the first complete Session or from Settings
- Settings: Reminders, the Player chime, exercise credits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:34:49 +01:00

1.3 KiB

ADR 0006 — The Streak is derived; Reminders are rescheduled, not repeating

Status: Accepted (2026-10-29)

Streak

The Streak, its Freezes and the calendar are computed from scratch from the end times of all complete Sessions (both Modes) every time they are shown (Streak.compute). Nothing about the Streak is stored: a Freeze is earned, held and spent deterministically by walking the days from the first Streak Day to today. The Grace Hour is applied while assigning Sessions to Streak Days, in time order, so the rule "counts for yesterday unless yesterday is already done" is stable.

A few years of daily Sessions is a few thousand rows, which is cheap to walk.

Reminders

Android cannot skip a repeating notification on days that are already done, so instead of repeating alarms the app schedules one-off notifications for the next 14 days and replaces them whenever something changes: on app start, after every saved Session and after a Reminder setting changes. A day that is done gets none. If the app is not opened for two weeks, Reminders stop; that is acceptable for a gentle nudge.

They use inexact scheduling (inexactAllowWhileIdle), which needs no exact-alarm permission but lets Android deliver up to about an hour late. Permission to post notifications is asked for after the first complete Session, or from Settings.