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
Merge #209: fix: cascade inherited loads while preserving manual set edits (Space-Hermes)
Duarte Santos175571e8fa6c
diff --cc frontend/src/lib/history.jsindex 28f64d62c,fc3f39c48..b0b570873--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@@ -1,7 -1,7 +1,7 @@@// Pure helpers over the state object S (ported 1:1 from the vanilla app).import { todayISO, isoOf, weekKey, weekStartOf, fmtNum } from './format.js'import { isCardio, isBodyweightEq, isAssisted, betterWeight } from './exercises.js'- import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode, completedVolumeOf, hasCompletedWork, nextDropWeight, splitBurstReps, makeSideSet, isSideSet, syncSideAggregate } from './workout-model.js'-import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode, completedVolumeOf, nextDropWeight, splitBurstReps, makeSideSet, isSideSet, syncSideAggregate, WEIGHT_ORIGIN_MANUAL } from './workout-model.js'++import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode, completedVolumeOf, hasCompletedWork, nextDropWeight, splitBurstReps, makeSideSet, isSideSet, syncSideAggregate, WEIGHT_ORIGIN_MANUAL } from './workout-model.js'const objectOf = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {}// Completed-state-independent work rows whose authoritative mode matches the requested mode.const workRowsForMode = (entry = {}, mode = 'reps') => {diff --cc frontend/src/lib/history.test.jsindex cacc468ff,ef716787e..4c7210bcc--- a/frontend/src/lib/history.test.js+++ b/frontend/src/lib/history.test.js@@@ -1,6 -1,6 +1,6 @@@import { describe, it, expect } from 'vitest'-import { nextTrainingDay, modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, setsDone, setsDoneActive, setUnits, doneUnits, setUnitsTotal, pairAdjacent, unpairSuperset, supersetUnits, applyIntensifierPlan, pinnedNoteFor, exNoteFor, effectiveRoutineIds, effectiveRoutines, effectiveRoutineId, effectiveRoutine, lastEntryFor, entryExcluded } from './history.js'+import { nextTrainingDay, modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, completedRepsOf, metricRowsForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, setsDone, setsDoneActive, setUnits, doneUnits, setUnitsTotal, pairAdjacent, unpairSuperset, supersetUnits, applyIntensifierPlan, pinnedNoteFor, exNoteFor, effectiveRoutineIds, effectiveRoutines, effectiveRoutineId, effectiveRoutine, lastEntryFor, entryExcluded, entryRoutineId, setsRepsOf } from './history.js'- import { makeSideSet, setSideField, toggleSide } from './workout-model.js'+ import { makeSideSet, setSideField, toggleSide, WEIGHT_ORIGIN_MANUAL } from './workout-model.js'import { EXDB } from './exercises.js'// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.diff --cc frontend/src/views/Workout.jsxindex 0e33df60c,9cf6cb273..8564bc23c--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@@ -17,11 -16,10 +17,11 @@@ import { startFlow, exercisePicker, exCimport { effortColor } from '../lib/effort.js'import Icon from '../components/Icon.jsx'import { Button, Check, NumberField } from '../components/ui.jsx'-import { nextPrescription, applyPrescription, defaultIncrement, weightIncrement, stepWeight } from '../lib/progression.js'+import { defaultIncrement, weightIncrement, stepWeight } from '../lib/progression.js'import { progressionGuidance } from '../lib/progression-copy.js'+import { buildPlannedEntry, plannedConfigOf } from '../lib/session-start.js'import { glyphOf } from '../lib/glyphs.js'- import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps, isSideSet, makeSideSet, setSideField, toggleSide, addSideDrop, removeSideDropAt, setSideDropAt, addSideCluster, removeSideClusterAt, setSideClusterAt } from '../lib/workout-model.js'+ import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps, isSideSet, makeSideSet, setSideField, toggleSide, addSideDrop, removeSideDropAt, setSideDropAt, addSideCluster, removeSideClusterAt, setSideClusterAt, WEIGHT_ORIGIN_MANUAL } from '../lib/workout-model.js'import { canMoveActiveWorkoutUnit, moveActiveWorkoutUnit } from '../lib/active-workout-order.js'import { MUSCLE_NAME } from '../lib/muscles.js'@@@ -654,13 -640,10 +663,14 @@@ function ActiveWorkout()// what was actually logged — in the session, in history and in a backup.const setField = (idx, i, field, v) => mutEntry(idx, e => {if (v == null) delete e.sets[i][field]; else e.sets[i][field] = v+ // Typing a duration IS the new plan, the same way ticking the row ends it: a plan a displaced+ // hold put aside must not outrank what you just typed, or the field would read 45 and the ▶+ // would still hold the 30 the row was asking for before.+ if (field === 'sec') delete e.sets[i].planSec- // Changing a weight cascades to the following sets of the same phase, so a- // heavier bar carries through the set instead of retyping every row.+ // Changing a weight cascades to following inherited sets of the same phase, so a correction+ // carries through without retyping every row while explicit manual exceptions stay put.if (field === 'w') {+ e.sets[i].weightOrigin = WEIGHT_ORIGIN_MANUALe.sets = cascadeWeight(e.sets, i, v)}})