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 summary: work sets count each side of a unilateral set, like the set total beside them

Duarte Santos6da32db0d053
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 75c198687..86d7701b7 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -850,10 +850,12 @@ export function removeRowAt(rows, i) {
return next
}
-/** Completed non-warm-up sets across a workout's entries. */
+/** Completed non-warm-up sets across a workout's entries, counted the way setsDone counts them —
+ * each side of a unilateral row on its own — so "22 sets · 19 work" never reads as three
+ * warm-ups on a workout that had none. */
export function workSetsDone(w) {
return (w?.entries || []).reduce(
- (n, e) => n + (e.sets || []).filter(s => s.done && !isWarmupRow(s)).length, 0,
+ (n, e) => n + (e.sets || []).reduce((m, s) => m + (isWarmupRow(s) ? 0 : doneUnits(s)), 0), 0,
)
}
diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js
index 0c76f54f7..a483ff617 100644
--- a/frontend/src/lib/history.test.js
+++ b/frontend/src/lib/history.test.js
@@ -771,6 +771,15 @@ describe('workoutVolume', () => {
expect(workSetsDone(w)).toBe(1)
})
+ it('counts work sets the way it counts all sets: each side of a unilateral row (QA 1.3.9)', () => {
+ const both = toggleSide(toggleSide(makeSideSet({ w: 20, r: 20 }), 'L'), 'R')
+ const one = toggleSide(makeSideSet({ w: 20, r: 20 }), 'L')
+ const w = { entries: [{ id: LIFT, sets: [both, one, { w: 30, r: 5, done: true }] }] }
+ expect(setsDone(w)).toBe(4)
+ // No warm-ups, so every set is a work set — the summary read "4 sets · 2 work".
+ expect(workSetsDone(w)).toBe(4)
+ })
+
it('does not use a warm-up as the previous best working weight', () => {
expect(bestWeightFor({ workouts: [{ entries: [{ id: LIFT, topW: 120, sets: [
{ phase: 'warmup', done: true, w: 120 },