perf: add projection + O(1) bucket math to muscle-heatmap endpoint
Endpoint previously pulled full WorkoutSession documents (including gpsTrack, notes, kcalEstimate etc.) to count sets per muscle group. Adds a projection that keeps only startTime + exercises.exerciseId + whole set objects — safe (avoids the malformed-sub-array issue the earlier narrower projection caused in the stats overview handler), but still drops the bulky session-level fields. Also swaps the per-session findIndex() over the weekly bucket array for direct date-math against the first bucket's Monday, turning bucket lookup from O(sessions × weeks) into O(sessions).
This commit is contained in:
@@ -10,7 +10,7 @@ Order = impact. Font items + app.html preload intentionally skipped.
|
||||
- [x] 4. Favorites page — drop unnecessary `all_brief` fetch (verified Search uses `favoritesOnly` so `allRecipes` was redundant)
|
||||
- [x] 5. Replace redundant `locals.auth()` with `locals.session` across all routes (68 files, 107 sites — loaders, actions, API endpoints)
|
||||
- [x] 6. Stream fitness stats loader — muscleHeatmap, nutritionStats, periods, sharedPeriods now stream via `{#await}`. `stats` still awaited (too many chart $deriveds depend on it)
|
||||
- [ ] 7. Overview endpoint — add `.select(...)` projection, cap timeseries window
|
||||
- [x] 7. Muscle-heatmap endpoint — add projection + O(1) bucket math. Overview already had a projection; set-subfield narrowing was attempted but reverted (returned malformed sets). Timeseries cap not feasible: totals are lifetime-scoped.
|
||||
- [ ] 8. Calendar payload trim — drop `name` from `yearDays`, pre-filter `feastDots` server-side
|
||||
- [ ] 9. History sessions endpoint — slim exercise payload for list view
|
||||
- [ ] 10. `Cache-Control` headers on stable API endpoints (all_brief, calendar, exercises metadata)
|
||||
|
||||
Reference in New Issue
Block a user