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.

Workout: a pyramid's plan line reads as its targets (#367)

Duarte Santosae36aa2ed8be
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index dcfab69c5..23538c31a 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -14,7 +14,7 @@ import { beep, vibrate, unlock } from '../lib/sound.js'
import { pinState } from '../lib/queue.js'
import { t, tn, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
import { api, beacon } from '../lib/api.js'
-import { pyramidRestFor, maxRecordAt } from '../lib/pyramid.js'
+import { pyramidRestFor, maxRecordAt, isPyramid, pyramidLabel } from '../lib/pyramid.js'
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, exitWorkoutEdit, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, renameWorkoutSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet, exerciseHistorySheet, addRoutineToSessionSheet } from '../sheets.jsx'
@@ -191,6 +191,9 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
const planLine = (() => {
if (!planned) return null
const today = entry.target || {}
+ // A pyramid reads as its targets, as on the routine row: "12 · 8 · 6 · Max · 12", never the
+ // set count times the first target (#367). Its rows are the plan; nothing moves them.
+ if (isPyramid(today)) return <div className="small dim planline" style={{ marginBottom: 4 }}>{t('Plan: {0}', pyramidLabel(today.pyramid))}</div>
const todaySets = today.sets || planned.sets || 1
const inPlan = timed
? today.sec == null || today.sec === planned.sec
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index 81d84b8b2..6163074cb 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -1645,6 +1645,11 @@ describe('the plan line', () => {
expect(container.textContent).not.toContain('40×15')
})
+ it('reads a pyramid as its targets, like the routine row (#367)', async () => {
+ await mount([planned({ planned: { sets: 5, reps: 12 }, target: { mode: 'reps', sets: 5, reps: 12, pyramid: [12, 8, 6, 'max', 12] } })])
+ expect(line()).toBe('Plan: 12 · 8 · 6 · Max · 12')
+ })
+
it('is not there for an entry with no plan (freestyle, or started before plans were kept)', async () => {
await mount([exercise('plain-bench', [false])])
expect(container.querySelector('.planline')).toBeNull()