Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Weekly muscle volume: a floating week or rotation is part of the plan too
Duarte Santos9e7e4e10ebd8
diff --git a/frontend/src/lib/muscles.js b/frontend/src/lib/muscles.jsindex 2c4b869fb..6d4603d87 100644--- a/frontend/src/lib/muscles.js+++ b/frontend/src/lib/muscles.js@@ -10,6 +10,7 @@import { isWarmupRow } from './workout-model.js'import { EXIDX, smOf } from './exercises.js'import { todayISO, weekKey, MONDAY } from './format.js'+import { queueOf } from './queue.js'// The muscles a map can shade, in head-to-toe order — also the order of any list// built from them, so "what am I neglecting" reads top-down like a body.@@ -292,18 +293,26 @@ export function muscleBalanceWindow(workouts, win, now = Date.now(), today = todexport const loadOfRoutine = (routine, exercises = {}) =>loadOf((routine?.ex || []).map(c => ({ id: c.id, ex: exercises[c.id] || c, sets: c.sets || 1 })))-/** Effective sets programmed by the live recurring week; overrides and history are not plans. */+/**+ * Effective sets programmed by the live recurring week; overrides and history are not plans.+ * A floating week or rotation (S.queue, lib/queue.js) is the plan too: each of its sessions once,+ * beside your own weekday routines — the same split the Home streak card tallies (weekTally).+ */export function loadOfWeeklyPlan(S) {const routines = new Map((S?.routines || []).map(routine => [routine.id, routine]))const exercises = Object.fromEntries((S?.customEx || []).map(exercise => [exercise.id, exercise]))+ const q = queueOf(S)+ const queued = new Set(q ? (S.queue.ids || []) : [])+ const ids = [+ ...Object.values(S?.week || {}).flatMap(value => [].concat(value || [])).filter(id => !queued.has(id)),+ ...(q ? q.ids : []),+ ]const load = {}- for (const value of Object.values(S?.week || {})) {- for (const id of [].concat(value || [])) {- const routine = routines.get(id)- if (!routine) continue- for (const [slug, sets] of Object.entries(loadOfRoutine(routine, exercises))) {- load[slug] = (load[slug] || 0) + sets- }+ for (const id of ids) {+ const routine = routines.get(id)+ if (!routine) continue+ for (const [slug, sets] of Object.entries(loadOfRoutine(routine, exercises))) {+ load[slug] = (load[slug] || 0) + sets}}return loaddiff --git a/frontend/src/lib/muscles.test.js b/frontend/src/lib/muscles.test.jsindex 43d9d65ac..f7715736e 100644--- a/frontend/src/lib/muscles.test.js+++ b/frontend/src/lib/muscles.test.js@@ -200,6 +200,13 @@ describe('planned weekly muscle volume', () => {expect(load.biceps).toBe(3)})+ it('counts a floating week once per session, beside the weekday routines it does not cover', () => {+ const queued = { ...state, queue: { ids: ['push', 'push', 'gone'], since: 0, startsOn: '2026-08-17' } }+ // weekday 'arms' (3) + the queue's 'push' once (2 chest, 0.8 triceps); the weekday 'push' rows+ // are the queue's session, not a second plan of their own.+ expect(loadOfWeeklyPlan(queued)).toEqual({ chest: 2, triceps: 0.8, biceps: 3 })+ })+it('returns an empty projection for missing or empty plans', () => {expect(loadOfWeeklyPlan()).toEqual({})expect(loadOfWeeklyPlan({ routines: [], week: { 1: ['missing'] } })).toEqual({})