Store time in zone instead of computing it #159

Closed
opened 2026-11-08 18:16:47 +00:00 by chris-kreidl · 2 comments
chris-kreidl commented 2026-11-08 18:16:47 +00:00 (Migrated from github.com)

(session 15) Time in zone is computed, not stored: each Progress load decodes every ride stream in the range. Fine for one athlete (13 rides with power in 3 months); for a year of power rides, or when the polarised-split rule needs it, store zone seconds on Ride at import and when thresholds change.

Moved from docs/PROGRESS.md → Follow-ups → Later on 2026-11-08.

(session 15) Time in zone is computed, not stored: each Progress load decodes every ride stream in the range. Fine for one athlete (13 rides with power in 3 months); for a year of power rides, or when the polarised-split rule needs it, store zone seconds on `Ride` at import and when thresholds change. _Moved from docs/PROGRESS.md → Follow-ups → Later on 2026-11-08._
chris-kreidl commented 2026-11-08 20:08:51 +00:00 (Migrated from github.com)

What this is about. Progress → Time in zone is worked out on each page load by decoding every ride stream in the range. Fine for a few months of rides; slow for a year of power rides.

Status (checked 2026-11-08): unchanged; zone seconds aren't stored.

Fix: store zone seconds on each ride at import, and recompute when thresholds change (the rescore already visits those rides). Session 53 (#228) grades the easy-share rule over planned zones, so it doesn't need this. #102 (Today's zones) would use the same stored numbers.

**What this is about.** Progress → Time in zone is worked out on each page load by decoding every ride stream in the range. Fine for a few months of rides; slow for a year of power rides. **Status (checked 2026-11-08):** unchanged; zone seconds aren't stored. **Fix:** store zone seconds on each ride at import, and recompute when thresholds change (the rescore already visits those rides). Session 53 (#228) grades the easy-share rule over *planned* zones, so it doesn't need this. #102 (Today's zones) would use the same stored numbers.
chris-kreidl commented 2026-11-19 03:21:37 +00:00 (Migrated from github.com)

Status (checked 2026-11-18): half done. #102 added Ride.powerHistogram (one additive migration), and Today's time in zone reads it. Progress still decodes every ride stream in the range for its time-in-zone chart (src/server/progress-store.ts:163).

What's left: Progress reads the stored power histogram instead of decoding streams. Heart-rate zones have no stored equivalent, so they still need the streams (or an hrHistogram alongside).

**Status (checked 2026-11-18):** half done. #102 added `Ride.powerHistogram` (one additive migration), and Today's time in zone reads it. Progress still decodes every ride stream in the range for its time-in-zone chart (`src/server/progress-store.ts:163`). **What's left:** Progress reads the stored power histogram instead of decoding streams. Heart-rate zones have no stored equivalent, so they still need the streams (or an `hrHistogram` alongside).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ckreidl/trainer#159
No description provided.