workout: give back the rest a re-checked set used to swallow
The other half of issue #3. "Breaks sometimes not shown after finished set (first / last)" — the last-set half was the quiet-finish rule, already fixed. This is the first-set half. Completing a set only counts as progress when it goes beyond the most sets this exercise has had done at once, so that unchecking and re-checking finished work does not replay navigation or reopen sheets. Correct, but it returned before anything could time a rest: uncheck a set to fix the reps, check it again, and nothing starts. If the original rest had already run out, you get no break at all — which is exactly what was reported, and why it reads as "sometimes". A re-check now fills that gap and only that gap: it starts a rest when none is running, and never touches one that is still counting down, because a running timer belongs to the set you finished most recently. Navigation and sheets stay gated exactly as before.
This commit is contained in:
1 parent
5ff6b7d0a8
commit
b28115a8f9
3 files changed
+47
-3
No files matched your search
@@ -8,7 +8,7 @@ import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { setProgressHighWater, supersetFlowStep, restAfterSet } from '../lib/supersetFlow.js'
|
||||
import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
@@ -411,7 +411,6 @@ function ActiveWorkout() {
|
||||
if (fresh && checked && fresh.entries[idx]) {
|
||||
const progress = setProgressHighWater(fresh.entries[idx], progressHighWater.current[idx] || 0)
|
||||
progressHighWater.current[idx] = progress.highWater
|
||||
if (!progress.isNew) return
|
||||
|
||||
const freshUnits = supersetUnits(fresh.entries)
|
||||
const freshUnit = freshUnits.find(u => u.includes(idx))
|
||||
@@ -419,6 +418,13 @@ function ActiveWorkout() {
|
||||
const freshLastUnit = freshUnitIdx >= freshUnits.length - 1
|
||||
const freshUnitDone = freshUnit?.every(ui => fresh.entries[ui].sets.every(x => x.done))
|
||||
|
||||
// A re-check of finished work must not navigate or reopen a sheet, but it may still owe
|
||||
// you a rest — see restOnRecheck, and the other half of issue #3.
|
||||
if (!progress.isNew) {
|
||||
if (restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshLastUnit })) startRest(S.restSec)
|
||||
return
|
||||
}
|
||||
|
||||
// Singleton units are ordinary exercises: they rest between sets and after the closing
|
||||
// one, and never enter superset navigation. stopRest() first so the rest that belongs
|
||||
// after this set replaces the one that was running, rather than stacking on it.
|
||||
|
||||
Reference in new issue
Block a user