Skip to content

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.

Unit switch converts the plan stamped on each logged exercise too

Duarte Santos8049f1bf0d27
diff --git a/frontend/src/lib/units.js b/frontend/src/lib/units.js
index 41ae4d052..8e83b2fc8 100644
--- a/frontend/src/lib/units.js
+++ b/frontend/src/lib/units.js
@@ -48,6 +48,8 @@ const convEntry = (e, from, to) => {
...e,
...(e.topW != null ? { topW: convertWeight(e.topW, from, to) } : {}),
...(e.target ? { target: convTarget(e.target, from, to) } : {}),
+ // The plan the entry was built from (lib/session-start.js) carries the routine's weight too.
+ ...(e.planned ? { planned: convTarget(e.planned, from, to) } : {}),
...(Array.isArray(e.sets) ? { sets: e.sets.map(s => convSet(s, from, to)) } : {}),
}
}
diff --git a/frontend/src/lib/units.test.js b/frontend/src/lib/units.test.js
index 6066d37bd..fdb9be1cd 100644
--- a/frontend/src/lib/units.test.js
+++ b/frontend/src/lib/units.test.js
@@ -26,7 +26,7 @@ describe('convertStateUnit', () => {
unit: 'kg', targetW: 80, bodyweight: [{ d: '2026-01-01', w: 82.4, t: 1 }],
exWeights: { '0025': { w: 80, d: '2026-01-01' }, legacy: 100 }, barWeights: { '0025': 20 },
routines: [{ id: 'r', ex: [{ id: '0025', sets: 3, reps: 5, weight: 80, inc: 2.5, warmup: [{ weight: 40, reps: 8 }] }, { id: 'plank', mode: 'time', sec: 30, inc: 5 }] }],
- workouts: [{ id: 'w', entries: [{ id: '0025', topW: 80, target: { weight: 80 }, sets: [{ w: 80, r: 5, done: true, drops: [{ w: 60, r: 5 }] }] }] }],
+ workouts: [{ id: 'w', entries: [{ id: '0025', topW: 80, target: { weight: 80 }, planned: { sets: 3, reps: 5, weight: 80 }, sets: [{ w: 80, r: 5, done: true, drops: [{ w: 60, r: 5 }] }] }] }],
active: { id: 'a', entries: [{ id: '0025', sets: [{ w: 82.5, r: 5, done: false }] }] },
workoutView: 'list',
}
@@ -40,7 +40,7 @@ describe('convertStateUnit', () => {
expect(out.barWeights['0025']).toBe(44)
expect(out.routines[0].ex[0]).toMatchObject({ weight: 176.5, inc: 5.5, warmup: [{ weight: 88, reps: 8 }] })
expect(out.routines[0].ex[1]).toEqual({ id: 'plank', mode: 'time', sec: 30, inc: 5 }) // seconds stay seconds
- expect(out.workouts[0].entries[0]).toMatchObject({ topW: 176.5, target: { weight: 176.5 } })
+ expect(out.workouts[0].entries[0]).toMatchObject({ topW: 176.5, target: { weight: 176.5 }, planned: { sets: 3, reps: 5, weight: 176.5 } })
expect(out.workouts[0].entries[0].sets[0]).toMatchObject({ w: 176.5, done: true, drops: [{ w: 132.5, r: 5 }] })
expect(out.active.entries[0].sets[0].w).toBe(182)
expect(out.workoutView).toBe('list')