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
fix: smaller same-area items from the review - future-dated clamp, LB_TO_KG export, value-based bodyweight guard
Space-Hermes23a5b6c22892
diff --git a/frontend/src/lib/recovery.js b/frontend/src/lib/recovery.jsindex d73b34543..5d63f005e 100644--- a/frontend/src/lib/recovery.js+++ b/frontend/src/lib/recovery.js@@ -66,7 +66,7 @@ function emptyMuscleMap(value) {const REP_CAP = 12const epley1RM = (load, reps) => load * (1 + Math.min(reps || 1, REP_CAP) / 30)-const LB_TO_KG = 0.45359237+export const LB_TO_KG = 0.45359237function numeric(value) {if (value === null || value === undefined || value === '' || typeof value === 'boolean') return null@@ -139,7 +139,7 @@ function bodyweightConfigured(ex, entry, set, workout, opts = {}) {const added = kgOf(set?.w, unitOf(set, entry?.target, entry, workout, opts))const hasBodyweightContext = numeric(workout?.bw) !== null|| numeric(workout?.bodyweight) !== null- || Object.prototype.hasOwnProperty.call(opts, 'bodyweightKg')+ || numeric(opts.bodyweightKg) !== null|| numeric(opts.bodyweight) !== null|| hasUnitStamp(set, entry?.target, entry, workout)return ex?.eq === 'body weight' && (added === 0 || hasBodyweightContext)@@ -253,7 +253,7 @@ function fatigueValue(events, now) {value += event.stimuluslastTimestamp = event.timestamp}- value *= halfLifeDecay(now - lastTimestamp, FATIGUE_HALF_LIFE_MS)+ value *= halfLifeDecay(Math.max(0, now - lastTimestamp), FATIGUE_HALF_LIFE_MS)// Normalise the accumulated stimulus to a saturating fatigue level: more volume starts// higher but never pins, and the value fades asymptotically - no window-edge cliff.return 1 - Math.exp(-value)diff --git a/frontend/src/lib/recovery.test.js b/frontend/src/lib/recovery.test.jsindex 11c1bee85..884f814f0 100644--- a/frontend/src/lib/recovery.test.js+++ b/frontend/src/lib/recovery.test.js@@ -476,6 +476,18 @@ describe('canonical loads and configured bodyweight', () => {}})+ it('treats a future-dated workout as its own timestamp, never amplified', () => {+ // A CSV import with a bad timezone can date a workout 10 days in the future. The final+ // decay clamps the age to zero instead of exponentiating, so the session counts exactly+ // like the same workout dated now - no 2^(10d/36h) ~ 102x amplification.+ const future = doneWorkoutAt(SINGLE.id, NOW + 10 * DAY, 5)+ const now = doneWorkoutAt(SINGLE.id, NOW, 5)+ const futureValue = fatigueOf([future], NOW)[SINGLE_SLUG]+ const nowValue = fatigueOf([now], NOW)[SINGLE_SLUG]+ expect(futureValue).toBeCloseTo(nowValue, 10)+ expect(futureValue).toBeLessThan(1)+ })+it('counts a default custom zero-load ring push-up for fatigue and load-blind strength', () => {const id = 'recovery-ring-push-up'registerCustom([{ id, n: 'Ring push-up', bp: 'chest', tg: 'chest', eq: 'custom', sm: [] }])diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsxindex 6b76ac851..14ef77bb4 100644--- a/frontend/src/views/Stats.jsx+++ b/frontend/src/views/Stats.jsx@@ -11,7 +11,7 @@ import Heatmap from '../components/Heatmap.jsx'import Icon from '../components/Icon.jsx'import BodyMap, { BodyMapLegend } from '../components/BodyMap.jsx'import { loadOfWorkouts, rankOf, MUSCLE_NAME, musclesOf } from '../lib/muscles.js'-import { fatigueOf, strengthOf, STRENGTH_FLOOR } from '../lib/recovery.js'+import { fatigueOf, strengthOf, STRENGTH_FLOOR, LB_TO_KG } from '../lib/recovery.js'import { fatigueStateOf } from '../lib/recovery-view.js'import { e1rmSeries, best1RM } from '../lib/onerm.js'import {@@ -106,7 +106,7 @@ function MuscleBalance({ S }) {if (!entries.length) return nullconst last = entries.slice().sort((a, b) => String(a.d).localeCompare(String(b.d))).at(-1)if (!last || !(last.w > 0)) return null- return S.unit === 'lb' ? last.w * 0.45359237 : last.w+ return S.unit === 'lb' ? last.w * LB_TO_KG : last.w}, [S.bodyweight, S.unit])const fatigue = useMemo(() => fatigueOf(workouts, now, { bodyweightKg, unit: S.unit }), [workouts, now, bodyweightKg, S.unit])const strength = useMemo(() => strengthOf(workouts, now, { bodyweightKg, unit: S.unit }), [workouts, now, bodyweightKg, S.unit])