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.

Plan file: Per side survives on timed holds

Duarte Santos20abc6a76003
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index c835d3580..3fd751443 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -88,8 +88,8 @@ function cleanEx(e) {
// How the exercise is logged travels too (issues #31/#32) — the bodyweight flag only when
// it disagrees with the catalogue, since agreeing is what the other end already assumes.
if (e.bodyweight != null && e.bodyweight !== isBodyweightEq(e.id)) o.bodyweight = e.bodyweight
- // Only on reps work — `side` counts reps, and a timed hold has none to split.
- if (e.side && mode !== 'time' && mode !== 'cardio') o.side = true
+ // Reps work and timed holds (a per-side hold is an L and an R hold per set); never cardio.
+ if (e.side && mode !== 'cardio') o.side = true
// Progression settings travel with the plan — a shared Greyskull routine that arrives
// without its rule is just a list of weights.
if (e.prog) o.prog = e.prog
diff --git a/frontend/src/lib/plan-share.test.js b/frontend/src/lib/plan-share.test.js
index 7ad086daa..7cbed1774 100644
--- a/frontend/src/lib/plan-share.test.js
+++ b/frontend/src/lib/plan-share.test.js
@@ -61,6 +61,14 @@ describe('plan-share units', () => {
})
describe('what survives a shared plan', () => {
+ it('carries Per side on a timed hold, and on reps work; never on cardio', () => {
+ const hold = roundTrip({ mode: 'time', sec: 30, sets: 2, reps: undefined, weight: undefined, side: true })
+ expect(hold).toMatchObject({ mode: 'time', sec: 30, sets: 2, side: true })
+ expect(roundTrip({ side: true }).side).toBe(true)
+ const cardio = parsePlan(JSON.stringify(buildPlanBundle({ routines: [{ id: 'r1', name: 'Run', ex: [{ id: '0025', sets: 1, mode: 'cardio', min: 20, side: true }] }], week: {}, customEx: [] }, 'Plan'))).routines[0].ex[0]
+ expect(cardio.side).toBeUndefined()
+ })
+
it('carries a drop-set prescription', () => {
expect(roundTrip({ intensifier: { type: 'dropset', count: 2, pct: 20 } }).intensifier)
.toEqual({ type: 'dropset', count: 2, pct: 20 })