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.

feat(progression): "Last time means": this routine or any workout (#770)

Duarte Santos9c574c17dc99
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 485d0f770..c2b13d34e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -80,8 +80,13 @@ per muscle. Settings → Workout → Fine-tuning turns it off.
Spoiler: it's a lot.
- **"No automatic progression" remembers what you did** (#217, thanks @iggaM23). With Settings →
Workout → Fine-tuning → Planned sessions start from → Your last session, an exercise with
- progression off now opens at last time's weight and reps, the way Strong does it, and the card says so. "Your
- plan" (the default) still opens at the routine's own numbers, and deload routines keep theirs.
+ progression off now opens at last time's weight and reps, the way Strong does it, and the card
+ says so. "Your plan" (the default) still opens at the routine's own numbers, and deload
+ routines keep theirs.
+- **"Last time" can mean any workout** (#770). Bench on Monday and Thursday? Settings → Workout →
+ Fine-tuning → Last time means → Any workout lets Thursday start from Monday, for the rows, the
+ "last time" line and progression alike. The default stays per routine, so a heavy day and a
+ light day keep their own numbers.
**Security.** Follow-ups to v1.4.2's audit.
- **Pairing the phone app asks you to confirm it's you** (passkey, or your password where that
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index ed672b75b..d8d6481df 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -358,16 +358,26 @@ export function entryRoutineId(w, en) {
// first one's history. Without, the first one, as it always was.
const entryIn = (w, exId, rid) => (w.entries || []).find(e => e && e.id === exId && (!rid || entryRoutineId(w, e) === rid))
+/**
+ * Whether "last time" is the exercise's last session in any workout rather than in the routine
+ * it is planned in (Settings → "Last time means", #770). Per routine by default: a heavy Monday
+ * and a light Thursday keep their own numbers (#216). 'any' is for the lifter who trains the same
+ * lift twice a week and wants Thursday to start from Monday. Read by the rows a session opens
+ * with, the "Your last session" line and the progression baseline alike, so they never disagree.
+ */
+export const lastAcrossRoutines = S => S?.lastFrom === 'any'
+
/**
* The last counting session of an exercise: `{ d, sets, target, rid?, planned? }`, or null.
*
* Given a routine id, the routine's own last session of it (issue #216): the same bench press in
* a heavy day and a light day is two lines of progress, not one that zigzags between them. A
* routine that has never trained the exercise falls back to its last session anywhere, so a new
- * or copied routine starts from what you actually lift rather than from nothing.
+ * or copied routine starts from what you actually lift rather than from nothing. With "Last time
+ * means → Any workout" (lastAcrossRoutines) the routine is ignored and the newest session wins.
*/
export function lastEntryFor(S, exId, rid) {
- if (rid) {
+ if (rid && !lastAcrossRoutines(S)) {
const own = lastEntryIn(S, exId, rid)
if (own) return own
}
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js
index 64bb81ddd..daef2dcca 100644
--- a/frontend/src/lib/progression.js
+++ b/frontend/src/lib/progression.js
@@ -16,7 +16,7 @@
// · fewer sets than prescribed → miss
// So a session that fell apart can never advance the load as though it had succeeded.
-import { modeOf, repStep, rerampWarmups, isBw, isPerSide, entryExcluded, entryRoutineId } from './history.js'
+import { modeOf, repStep, rerampWarmups, isBw, isPerSide, entryExcluded, entryRoutineId, lastAcrossRoutines } from './history.js'
import { EXIDX, isAssisted, isLoadedEq, defaultIncrement } from './exercises.js'
import { isWarmupRow, isSideSet, syncSideAggregate, makeSideSet } from './workout-model.js'
import { normalizeRepRange } from './rep-range.js'
@@ -328,9 +328,10 @@ export function readSession(entry, fallback) {
* no session of its own reads the exercise's whole history instead, so a new or copied routine
* continues from where you are. Each session carries the routine it came from (`rid`) and the
* plan it was built from (`planned`), so the caller can tell a borrowed or outdated baseline.
+ * "Last time means → Any workout" (#770) reads the whole history as one line, routine or not.
*/
export function sessionsFor(S, exId, fallback, rid) {
- if (rid) {
+ if (rid && !lastAcrossRoutines(S)) {
const own = sessionsIn(S, exId, fallback, rid)
if (own.length) return own
}
@@ -491,8 +492,14 @@ export function nextPrescription(S, cfg, routine) {
// routine no longer asks for. The sets and reps are the routine's own (double progression aims
// inside its new range, from what you managed).
// A borrowed session saved before plans were stamped is taken as a different plan.
- const borrowed = !!routine?.id && last.rid !== routine.id
- if (last.planned ? planChanged(last.planned, cfg) : borrowed) {
+ // With "Last time means → Any workout" (#770) another routine's session is not borrowed, it is
+ // simply the last one: one line of progress across routines, so only an edit of this routine's
+ // own plan restarts it. Held against the other routine's plan, Monday's 3 × 5 would restart
+ // Thursday's 3 × 8 every single week.
+ const across = lastAcrossRoutines(S)
+ const borrowed = !!routine?.id && !across && last.rid !== routine.id
+ const ownPlan = !across || !routine?.id || last.rid === routine.id
+ if (last.planned && ownPlan ? planChanged(last.planned, cfg) : borrowed) {
const why = borrowed ? ['First time in this routine, so starting from its own target.'] : ['Plan changed, so starting from your new target.']
// The weight holds at what was last lifted, unless the plan's own weight is not the one the
// session was built from: the same edit that turned 3 × 5 @ 100 into 3 × 10 @ 70 set 70,
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 5ba0c32d1..66a97a5af 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('50a3caa2f525165b7ee0326260394f22b578b0bbdc0a2bf202c89769a1f07bb0')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1c6650cfb2c4eaca1bb601191bed943d103c9c0632a662833c543821c366279e')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/lib/session-start.last-from.test.js b/frontend/src/lib/session-start.last-from.test.js
new file mode 100644
index 000000000..ea0470174
--- /dev/null
+++ b/frontend/src/lib/session-start.last-from.test.js
@@ -0,0 +1,97 @@
+// "Last time means → Any workout" (#770): the same lift on Monday and Thursday read as one line of
+// history instead of one per routine. The default keeps each routine's own last session (#216),
+// for the lifter whose Monday is heavy and Thursday light. Sessions are started and finished the
+// way the app does it, so the history has the shape the app saves.
+import { describe, it, expect } from 'vitest'
+import { buildCombinedEntries } from './session-merge.js'
+import { buildCompletedWorkout } from './finish-workout.js'
+import { lastEntryFor, lastAcrossRoutines } from './history.js'
+import { isWarmupRow } from './workout-model.js'
+
+const BENCH = '0025' // barbell bench press, 2.5 kg step
+const work = e => e.sets.filter(s => !isWarmupRow(s))
+const clone = v => JSON.parse(JSON.stringify(v))
+const state = (routines, extra = {}) => ({ unit: 'kg', exWeights: {}, routines: clone(routines), workouts: [], week: {}, dayPlan: {}, ...extra })
+const start = (st, rids) => buildCombinedEntries(st, rids).entries
+
+let day = 1
+function train(st, rids, typed) {
+ const entries = start(st, rids).map(e => ({ ...e, sets: e.sets.map(s => (isWarmupRow(s) ? { ...s, done: true } : { ...s, ...(typed || {}), done: true })) }))
+ const d = `2026-08-${String(day).padStart(2, '0')}`
+ const active = { id: 'w' + day, d, start: day * 1000, routineIds: rids, name: 'x', entries }
+ day++
+ st.workouts.push(buildCompletedWorkout(active, { end: active.start + 1 }))
+}
+
+const twoDays = (a = {}, b = {}) => [
+ { id: 'MON', name: 'Monday', ex: [{ id: BENCH, sets: 2, reps: 5, weight: 100, prog: 'linear', ...a }] },
+ { id: 'THU', name: 'Thursday', ex: [{ id: BENCH, sets: 2, reps: 5, weight: 100, prog: 'linear', ...b }] },
+]
+
+describe('"Last time means"', () => {
+ it('is the routine\'s own last session by default, and for a profile that never chose', () => {
+ expect(lastAcrossRoutines({})).toBe(false)
+ expect(lastAcrossRoutines({ lastFrom: 'routine' })).toBe(false)
+ expect(lastAcrossRoutines({ lastFrom: 'any' })).toBe(true)
+ })
+
+ it('per routine, Thursday progresses from last Thursday even after a better Monday', () => {
+ const st = state(twoDays())
+ train(st, ['THU'])
+ train(st, ['MON'])
+ train(st, ['MON']) // Monday is up to 102.5 now
+ const [thu] = start(st, ['THU'])
+ expect(work(thu).map(s => s.w)).toEqual([102.5, 102.5])
+ expect(lastEntryFor(st, BENCH, 'THU').d).toBe('2026-08-01')
+ })
+
+ it('across workouts, Thursday picks up from Monday', () => {
+ const st = state(twoDays(), { lastFrom: 'any' })
+ train(st, ['THU'])
+ train(st, ['MON'])
+ train(st, ['MON']) // one line now: 100 Thursday, 102.5 and 105 on Monday
+ const [thu] = start(st, ['THU'])
+ expect(thu.plan.kind).toBe('up')
+ expect(work(thu).map(s => s.w)).toEqual([107.5, 107.5])
+ // The "Your last session" line reads the same session the rows came from.
+ const last = lastEntryFor(st, BENCH, 'THU')
+ expect(last.rid).toBe('MON')
+ expect(last.sets.map(s => s.w)).toEqual([105, 105])
+ })
+
+ it('across workouts, another routine\'s different plan is no reason to restart', () => {
+ const st = state(twoDays({}, { reps: 8, weight: 80 }), { lastFrom: 'any' })
+ train(st, ['THU'])
+ train(st, ['MON'])
+ const [thu] = start(st, ['THU'])
+ expect(thu.plan.why[0]).not.toBe('Plan changed, so starting from your new target.')
+ expect(thu.plan.why[0]).not.toBe('First time in this routine, so starting from its own target.')
+ expect(work(thu).map(s => s.r)).toEqual([8, 8])
+ })
+
+ it('across workouts, editing this routine\'s own plan still restarts it', () => {
+ const st = state(twoDays(), { lastFrom: 'any' })
+ train(st, ['THU'])
+ st.routines[1].ex[0].reps = 8
+ const [thu] = start(st, ['THU'])
+ expect(thu.plan.why[0]).toBe('Plan changed, so starting from your new target.')
+ })
+
+ it('with progression off and "Your last session", the rows copy the newest session anywhere', () => {
+ const st = state(twoDays({ prog: 'off' }, { prog: 'off' }), { lastFrom: 'any', startFrom: 'last' })
+ train(st, ['THU'], { w: 90, r: 6 })
+ train(st, ['MON'], { w: 110, r: 4 })
+ const [thu] = start(st, ['THU'])
+ expect(work(thu).map(s => [s.w, s.r])).toEqual([[110, 4], [110, 4]])
+ st.lastFrom = 'routine'
+ const [own] = start(st, ['THU'])
+ expect(work(own).map(s => [s.w, s.r])).toEqual([[90, 6], [90, 6]])
+ })
+
+ it('still skips a deload session, wherever it was', () => {
+ const st = state([...twoDays(), { id: 'DL', name: 'Deload', excludeFromProgression: true, ex: [{ id: BENCH, sets: 2, reps: 5, weight: 60 }] }], { lastFrom: 'any' })
+ train(st, ['MON'])
+ train(st, ['DL'])
+ expect(lastEntryFor(st, BENCH, 'THU').rid).toBe('MON')
+ })
+})
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 90718ab6d..f6cc67b55 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1337,6 +1337,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'مجموعات الروتين وتكراراته. سجلّك يحدد الوزن.',
'Your last session': 'جلستك الأخيرة',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'تُنقل التكرارات المسجّلة في آخر مرة في هذا الروتين. وعند إيقاف التدرّج، الوزن أيضًا.',
+ 'Last time means': '"آخر مرة" تعني',
+ 'This routine': 'هذا الروتين',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'آخر جلسة للتمرين في الروتين نفسه. يبقى اليوم الثقيل واليوم الخفيف منفصلين.',
+ 'Any workout': 'أي تمرين',
+ 'The last time you did the exercise, whichever routine it was in.': 'آخر مرة أدّيت فيها التمرين، أيًّا كان الروتين.',
'Plan changed, so starting from your new target.': 'تغيّرت الخطة، لذا نبدأ من هدفك الجديد.',
'First time in this routine, so starting from its own target.': 'أول مرة في هذا الروتين، لذا نبدأ من هدفه الخاص.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'لم يُسجَّل وزن في المرة الماضية. أدخل الوزن الذي ترفعه وسيتابع التدرّج من هناك.',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 54703815c..9eeab9cc5 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -1471,6 +1471,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'রুটিনের সেট ও রেপ। ওজন ঠিক করে আপনার ইতিহাস।',
'Your last session': 'আপনার শেষ সেশন',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'ওই রুটিনে গতবার লগ করা রেপ আনা হয়। অগ্রগতি বন্ধ থাকলে ওজনও।',
+ 'Last time means': '"গতবার" মানে',
+ 'This routine': 'এই রুটিন',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'একই রুটিনে এই এক্সারসাইজের শেষ সেশন। ভারী দিন আর হালকা দিন আলাদা থাকে।',
+ 'Any workout': 'যেকোনো ওয়ার্কআউট',
+ 'The last time you did the exercise, whichever routine it was in.': 'শেষবার আপনি এক্সারসাইজটি করেছিলেন, যে রুটিনেই হোক।',
'Plan changed, so starting from your new target.': 'প্ল্যান বদলেছে, তাই আপনার নতুন লক্ষ্য থেকে শুরু।',
'First time in this routine, so starting from its own target.': 'এই রুটিনে প্রথমবার, তাই এর নিজস্ব লক্ষ্য থেকে শুরু।',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'গতবার কোনো ওজন লগ হয়নি। আপনি যা তোলেন তা লিখুন, এরপর প্রগ্রেশন সেখান থেকে এগোবে।',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index a1793853a..fe32e04ed 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1432,6 +1432,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Die Sätze und Wiederholungen der Routine. Das Gewicht ergibt sich aus deinem Verlauf.',
'Your last session': 'Deine letzte Einheit',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Die Wiederholungen der letzten Einheit dieser Routine werden übernommen. Bei ausgeschalteter Progression auch das Gewicht.',
+ 'Last time means': '„Letztes Mal“ heißt',
+ 'This routine': 'Diese Routine',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Deine letzte Einheit der Übung in derselben Routine. Schwerer und leichter Tag bleiben getrennt.',
+ 'Any workout': 'Jedes Training',
+ 'The last time you did the exercise, whichever routine it was in.': 'Das letzte Mal, als du die Übung gemacht hast, egal in welcher Routine.',
'Plan changed, so starting from your new target.': 'Plan geändert, also geht es mit deiner neuen Vorgabe los.',
'First time in this routine, so starting from its own target.': 'Zum ersten Mal in dieser Routine, also geht es mit ihrer eigenen Vorgabe los.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Letztes Mal kein Gewicht eingetragen. Trag ein, was du bewegst, dann übernimmt die Progression.',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 2da59a5bd..675a35891 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Las series y repeticiones de la rutina. Tu historial decide el peso.',
'Your last session': 'Tu última sesión',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Se mantienen las repeticiones de la última vez en esa rutina. Con la progresión desactivada, también el peso.',
+ 'Last time means': '"La última vez" es',
+ 'This routine': 'Esta rutina',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Tu última sesión del ejercicio en la misma rutina. El día pesado y el ligero van por separado.',
+ 'Any workout': 'Cualquier entreno',
+ 'The last time you did the exercise, whichever routine it was in.': 'La última vez que hiciste el ejercicio, en la rutina que fuera.',
'Plan changed, so starting from your new target.': 'El plan cambió, así que empiezas desde tu nuevo objetivo.',
'First time in this routine, so starting from its own target.': 'Primera vez en esta rutina, así que empiezas desde su propio objetivo.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'La última vez no se registró peso. Introduce lo que levantas y la progresión sigue desde ahí.',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 2ef4c7aea..bb97e431d 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Les séries et répétitions de la routine. Ton historique décide du poids.',
'Your last session': 'Ta dernière séance',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Les répétitions de la dernière fois dans cette routine sont reprises. Avec la progression désactivée, le poids aussi.',
+ 'Last time means': '« La dernière fois », c’est',
+ 'This routine': 'Cette routine',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Ta dernière séance de l’exercice dans la même routine. Jour lourd et jour léger restent séparés.',
+ 'Any workout': 'N’importe quelle séance',
+ 'The last time you did the exercise, whichever routine it was in.': 'La dernière fois que tu as fait l’exercice, peu importe la routine.',
'Plan changed, so starting from your new target.': 'Plan modifié, donc on repart de ton nouvel objectif.',
'First time in this routine, so starting from its own target.': 'Première fois dans cette routine, donc on part de son propre objectif.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Aucun poids noté la dernière fois. Entre ce que tu soulèves et la progression prend le relais.',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index e1c40e8fc..7676278e8 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'रूटीन के सेट और रेप्स। वज़न आपका इतिहास तय करता है।',
'Your last session': 'आपका पिछला सेशन',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'उस रूटीन में पिछली बार दर्ज किए गए रेप्स आगे लाए जाते हैं। प्रगति बंद हो तो वज़न भी।',
+ 'Last time means': '"पिछली बार" का मतलब',
+ 'This routine': 'यही रूटीन',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'इसी रूटीन में इस एक्सरसाइज़ का पिछला सेशन। भारी दिन और हल्का दिन अलग रहते हैं।',
+ 'Any workout': 'कोई भी वर्कआउट',
+ 'The last time you did the exercise, whichever routine it was in.': 'पिछली बार जब आपने यह एक्सरसाइज़ की, रूटीन चाहे जो हो।',
'Plan changed, so starting from your new target.': 'प्लान बदला, इसलिए आपके नए लक्ष्य से शुरुआत।',
'First time in this routine, so starting from its own target.': 'इस रूटीन में पहली बार, इसलिए इसके अपने लक्ष्य से शुरुआत।',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'पिछली बार कोई वज़न दर्ज नहीं हुआ। जितना उठाते हैं उतना दर्ज करें, प्रगति वहीं से आगे बढ़ेगी।',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 7cdc9e37b..3280cb531 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1415,6 +1415,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'A rutin sorozatai és ismétlései. A súlyt az előzményeid döntik el.',
'Your last session': 'Az utolsó edzésed',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'A rutin legutóbbi ismétlései átkerülnek. Kikapcsolt haladásnál a súly is.',
+ 'Last time means': 'A „legutóbb” jelentése',
+ 'This routine': 'Ez a rutin',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'A gyakorlat legutóbbi edzése ugyanebben a rutinban. A nehéz és a könnyű nap külön marad.',
+ 'Any workout': 'Bármelyik edzés',
+ 'The last time you did the exercise, whichever routine it was in.': 'Amikor legutóbb csináltad a gyakorlatot, bármelyik rutinban.',
'Plan changed, so starting from your new target.': 'A terv megváltozott, így az új célodtól indulsz.',
'First time in this routine, so starting from its own target.': 'Először ebben a rutinban, így a saját céljától indulsz.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Legutóbb nem volt súly rögzítve. Add meg, mennyit emelsz, és onnan a progresszió viszi tovább.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index ad369b7ea..da2d4777d 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Serie e ripetizioni della routine. Il peso lo decide il tuo storico.',
'Your last session': 'La tua ultima sessione',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Vengono riprese le ripetizioni registrate l’ultima volta in quella routine. Con la progressione disattivata, anche il peso.',
+ 'Last time means': '"L’ultima volta" vuol dire',
+ 'This routine': 'Questa routine',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'La tua ultima sessione dell’esercizio nella stessa routine. Giorno pesante e giorno leggero restano separati.',
+ 'Any workout': 'Qualsiasi allenamento',
+ 'The last time you did the exercise, whichever routine it was in.': 'L’ultima volta che hai fatto l’esercizio, in qualunque routine.',
'Plan changed, so starting from your new target.': 'Piano cambiato, quindi si riparte dal tuo nuovo obiettivo.',
'First time in this routine, so starting from its own target.': 'Prima volta in questa routine, quindi si parte dal suo obiettivo.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Nessun peso registrato l’ultima volta. Inserisci quanto sollevi e la progressione riparte da lì.',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index b3d2812b0..3fbdd2a22 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': '루틴의 세트와 횟수. 무게는 기록에 따라 정해집니다.',
'Your last session': '지난 세션',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': '그 루틴에서 지난번에 기록한 횟수를 그대로 가져옵니다. 진행이 꺼져 있으면 무게도 가져옵니다.',
+ 'Last time means': '\'지난번\' 기준',
+ 'This routine': '이 루틴',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': '같은 루틴에서 이 운동을 한 지난 세션이에요. 무거운 날과 가벼운 날이 따로 가요.',
+ 'Any workout': '모든 운동',
+ 'The last time you did the exercise, whichever routine it was in.': '루틴과 상관없이 이 운동을 마지막으로 한 때예요.',
'Plan changed, so starting from your new target.': '계획이 바뀌어서 새 목표부터 시작해요.',
'First time in this routine, so starting from its own target.': '이 루틴은 처음이라 루틴의 목표부터 시작해요.',
'No weight logged last time. Enter what you lift and progression takes it from there.': '지난번에 기록된 무게가 없어요. 드는 무게를 입력하면 거기서부터 진행해요.',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 552b408e3..c6e92786d 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Serie i powtórzenia z planu treningowego. Ciężar wynika z twojej historii.',
'Your last session': 'Twoja ostatnia sesja',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Powtórzenia z ostatniego razu w tej rutynie są przenoszone. Przy wyłączonej progresji także ciężar.',
+ 'Last time means': '„Ostatnio” oznacza',
+ 'This routine': 'Ten plan treningowy',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Twoja ostatnia sesja ćwiczenia w tym samym planie treningowym. Ciężki i lekki dzień liczą się osobno.',
+ 'Any workout': 'Dowolny trening',
+ 'The last time you did the exercise, whichever routine it was in.': 'Ostatni raz, kiedy robiłeś to ćwiczenie, w jakimkolwiek planie.',
'Plan changed, so starting from your new target.': 'Plan się zmienił, więc zaczynasz od nowego celu.',
'First time in this routine, so starting from its own target.': 'Pierwszy raz w tym planie treningowym, więc zaczynasz od jego własnego celu.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Ostatnio nie zapisano ciężaru. Wpisz, ile podnosisz, a progresja ruszy od tego miejsca.',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 22d057331..8db3cf1eb 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -834,6 +834,8 @@ export const PT_BR_OVERRIDES = {
'The routine’s sets and reps. Your history decides the weight.': 'As séries e repetições da rotina. Seu histórico decide o peso.',
'Your last session': 'Sua última sessão',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'São mantidas as repetições que você registrou da última vez nessa rotina. Com a progressão desativada, o peso também.',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Sua última sessão do exercício na mesma rotina. Dia pesado e dia leve ficam separados.',
+ 'The last time you did the exercise, whichever routine it was in.': 'A última vez que você fez o exercício, em qualquer rotina.',
'Plan changed, so starting from your new target.': 'O plano mudou, então você começa pela sua nova meta.',
'First time in this routine, so starting from its own target.': 'Primeira vez nesta rotina, então você começa pela meta dela.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Nenhum peso registrado da última vez. Informe quanto você levanta e a progressão segue daí.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 3b1a8b053..aa79bed4b 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'As séries e repetições da rotina. O teu histórico decide o peso.',
'Your last session': 'A tua última sessão',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Mantêm-se as repetições que registaste da última vez nessa rotina. Com a progressão desativada, também o peso.',
+ 'Last time means': '"Da última vez" é',
+ 'This routine': 'Esta rotina',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'A tua última sessão do exercício na mesma rotina. Dia pesado e dia leve ficam separados.',
+ 'Any workout': 'Qualquer treino',
+ 'The last time you did the exercise, whichever routine it was in.': 'A última vez que fizeste o exercício, fosse em que rotina fosse.',
'Plan changed, so starting from your new target.': 'O plano mudou, por isso começas a partir do teu novo objetivo.',
'First time in this routine, so starting from its own target.': 'Primeira vez nesta rotina, por isso começas a partir do objetivo dela.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Nenhum peso registado da última vez. Introduz o que levantas e a progressão segue a partir daí.',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 7a08407af..6b722e0ac 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1381,6 +1381,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Подходы и повторения из программы. Вес определяет ваша история.',
'Your last session': 'Ваша последняя тренировка',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Повторения с прошлого раза в этой программе переносятся. При выключенной прогрессии — и вес.',
+ 'Last time means': '«Прошлый раз» это',
+ 'This routine': 'Эта программа',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Твоя последняя тренировка этого упражнения в той же программе. Тяжёлый и лёгкий день идут отдельно.',
+ 'Any workout': 'Любая тренировка',
+ 'The last time you did the exercise, whichever routine it was in.': 'Последний раз, когда ты делал это упражнение, в какой угодно программе.',
'Plan changed, so starting from your new target.': 'План изменён, поэтому начинаем с новой цели.',
'First time in this routine, so starting from its own target.': 'Впервые в этой программе, поэтому начинаем с её собственной цели.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'В прошлый раз вес не был записан. Укажите, с каким весом работаете, и дальше прогрессия подхватит.',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 385803865..d1c66712a 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1423,6 +1423,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'จำนวนเซ็ตและครั้งตามรูทีน ส่วนน้ำหนักขึ้นอยู่กับประวัติของคุณ',
'Your last session': 'เซสชันล่าสุดของคุณ',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'นำจำนวนครั้งที่บันทึกไว้ครั้งก่อนในรูทีนนั้นมาใช้ และถ้าปิดความก้าวหน้าก็รวมน้ำหนักด้วย',
+ 'Last time means': '"ครั้งที่แล้ว" หมายถึง',
+ 'This routine': 'รูทีนนี้',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'เซสชันล่าสุดของท่านี้ในรูทีนเดียวกัน วันหนักกับวันเบาแยกกัน',
+ 'Any workout': 'การฝึกใดก็ได้',
+ 'The last time you did the exercise, whichever routine it was in.': 'ครั้งล่าสุดที่คุณเล่นท่านี้ ไม่ว่าจะอยู่ในรูทีนไหน',
'Plan changed, so starting from your new target.': 'แผนเปลี่ยนแล้ว จึงเริ่มจากเป้าหมายใหม่ของคุณ',
'First time in this routine, so starting from its own target.': 'ครั้งแรกในรูทีนนี้ จึงเริ่มจากเป้าหมายของรูทีนเอง',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'ครั้งก่อนไม่ได้บันทึกน้ำหนัก กรอกน้ำหนักที่คุณยก แล้วการเพิ่มน้ำหนักจะรับช่วงต่อจากตรงนั้น',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 06e25e952..c93bbb876 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Rutinin setleri ve tekrarları. Ağırlığı geçmişin belirler.',
'Your last session': 'Son seansın',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'O rutinde geçen sefer kaydettiğin tekrarlar aktarılır. İlerleme kapalıysa ağırlık da.',
+ 'Last time means': '"Geçen sefer" demek',
+ 'This routine': 'Bu rutin',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Hareketin aynı rutindeki son seansı. Ağır gün ve hafif gün ayrı kalır.',
+ 'Any workout': 'Herhangi bir antrenman',
+ 'The last time you did the exercise, whichever routine it was in.': 'Hareketi son yaptığın zaman, hangi rutinde olursa olsun.',
'Plan changed, so starting from your new target.': 'Plan değişti, bu yüzden yeni hedefinden başlıyorsun.',
'First time in this routine, so starting from its own target.': 'Bu rutinde ilk kez, bu yüzden rutinin kendi hedefinden başlıyorsun.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Geçen sefer ağırlık kaydedilmedi. Kaldırdığın ağırlığı gir, ilerleme oradan devralsın.',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 102c6472d..b2b4c2c53 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1279,6 +1279,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': 'Підходи й повторення з програми. Вагу визначає твоя історія.',
'Your last session': 'Твоє останнє тренування',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': 'Повторення з минулого разу в цій програмі переносяться. Якщо прогресію вимкнено — і вага.',
+ 'Last time means': '«Минулого разу» означає',
+ 'This routine': 'Ця програма',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': 'Твоє останнє тренування цієї вправи в тій самій програмі. Важкий і легкий день ідуть окремо.',
+ 'Any workout': 'Будь-яке тренування',
+ 'The last time you did the exercise, whichever routine it was in.': 'Останній раз, коли ти робив цю вправу, в будь-якій програмі.',
'Plan changed, so starting from your new target.': 'План змінено, тож починаємо з нової цілі.',
'First time in this routine, so starting from its own target.': 'Уперше в цій програмі, тож починаємо з її власної цілі.',
'No weight logged last time. Enter what you lift and progression takes it from there.': 'Минулого разу вагу не записано. Вкажи, з якою вагою працюєш, і прогресія продовжить звідти.',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 5f41ee3d0..d88672cad 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1396,6 +1396,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': '組數與次數依據課表設定;重量則由歷史紀錄決定。',
'Your last session': '你上次的訓練表現',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': '沿用你上次在該訓練日記錄的次數。關閉進階時,重量也一併沿用。',
+ 'Last time means': '「上次」指的是',
+ 'This routine': '這份課表',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': '同一份課表裡這個動作的上一次。重日和輕日各算各的。',
+ 'Any workout': '任何訓練',
+ 'The last time you did the exercise, whichever routine it was in.': '你上一次做這個動作的時候,不管是哪份課表。',
'Plan changed, so starting from your new target.': '課表已變更,所以從你的新目標開始。',
'First time in this routine, so starting from its own target.': '第一次練這份課表,所以從它自己的目標開始。',
'No weight logged last time. Enter what you lift and progression takes it from there.': '上次沒有記錄重量。填上你實際舉的重量,漸進就會從那裡接手。',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 7fef9bd18..fcbfe56a7 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1412,6 +1412,11 @@ export default {
'The routine’s sets and reps. Your history decides the weight.': '按训练日的组数和次数,重量由你的历史记录决定。',
'Your last session': '你的上次训练',
'The reps you logged last time in that routine, carried over. With progression off, the weight too.': '沿用你上次在该训练日记录的次数。关闭进阶时,重量也一并沿用。',
+ 'Last time means': '“上次”指的是',
+ 'This routine': '这个训练日',
+ 'Your last session of the exercise in the same routine. Heavy day and light day stay apart.': '同一个训练日里这个动作的上一次。重训日和轻训日互不干扰。',
+ 'Any workout': '任意训练',
+ 'The last time you did the exercise, whichever routine it was in.': '你上一次做这个动作的时候,不管是哪个训练日。',
'Plan changed, so starting from your new target.': '计划已更改,所以从你的新目标开始。',
'First time in this routine, so starting from its own target.': '第一次练这个训练日,所以从它自己的目标开始。',
'No weight logged last time. Enter what you lift and progression takes it from there.': '上次没有记录重量。填上你实际举的重量,进阶就从那里接手。',
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index ef0b40b74..bf04e0cd8 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -227,6 +227,10 @@ export const DEF = {
// and the weight too for an exercise with progression off (nothing else decides it).
// Absent reads as 'plan' too, which is what the MCP bridge sees on a raw state file.
startFrom: 'plan',
+ // Where "last time" is read from (Settings → During a workout, lib/history.js lastAcrossRoutines,
+ // #770): 'routine' is the routine's own last session of the exercise, as it has been since #216;
+ // 'any' is its newest session in any workout. Absent reads as 'routine'.
+ lastFrom: 'routine',
// Per-language choice for translated exercise names: whether the original English name is
// shown in parentheses next to the translation. Map { '<lang>': boolean }; a missing key
// (any profile written before this setting existed) reads as shown.
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index d8b0a1d77..924d6fc4d 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -598,6 +598,15 @@ export default function Settings({ page = null, find = null, via = null, entryKe
{ value: 'plan', label: t('Your plan'), subtitle: t('The routine’s sets and reps. Your history decides the weight.') },
{ value: 'last', label: t('Your last session'), subtitle: t('The reps you logged last time in that routine, carried over. With progression off, the weight too.') },
]} />
+ {/* Where "last time" is read from (lib/history.js lastAcrossRoutines, #770): the routine's
+ own last session by default (#216), so a heavy and a light day keep their numbers.
+ 'any' reads the exercise's newest session wherever it was. Absent reads as the routine. */}
+ <SelectRow icon="history" iconTint="var(--indigo)" title={t('Last time means')}
+ value={S.lastFrom === 'any' ? 'any' : 'routine'} onChange={v => update(s => { s.lastFrom = v })}
+ options={[
+ { value: 'routine', label: t('This routine'), subtitle: t('Your last session of the exercise in the same routine. Heavy day and light day stay apart.') },
+ { value: 'any', label: t('Any workout'), subtitle: t('The last time you did the exercise, whichever routine it was in.') },
+ ]} />
<Row icon="stopwatch" iconTint="var(--orange)" title={t('Keep timing after target')}
subtitle={t('Timed sets continue up to 15 extra minutes. Tap Done to log the actual duration.')}>
<Switch aria-label={t('Keep timing after target')} checked={!!S.timedSetOvertime}
diff --git a/frontend/src/views/Settings.startfrom.test.jsx b/frontend/src/views/Settings.startfrom.test.jsx
index 11866a1a8..228a79bd6 100644
--- a/frontend/src/views/Settings.startfrom.test.jsx
+++ b/frontend/src/views/Settings.startfrom.test.jsx
@@ -102,3 +102,34 @@ describe('Settings — planned sessions start from', () => {
expect(mocks.S.startFrom).toBe('plan')
})
})
+
+describe('Settings — last time means (#770)', () => {
+ const lastRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Last time means'))
+ const pick = label => {
+ act(() => { lastRow().click() })
+ const box = document.createElement('div')
+ document.body.appendChild(box)
+ const sheetRoot = createRoot(box)
+ act(() => sheetRoot.render(sheet(() => {})))
+ const option = [...box.querySelectorAll('button.lrow')].find(b => b.querySelector('.lrow-t')?.textContent === label)
+ expect(option).toBeTruthy()
+ act(() => { option.click() })
+ act(() => sheetRoot.unmount())
+ box.remove()
+ }
+
+ it('reads an older profile without the setting as this routine', () => {
+ mount()
+ expect(lastRow().textContent).toContain('This routine')
+ })
+
+ it('switches to any workout and back, writing lastFrom to the store', () => {
+ mount()
+ pick('Any workout')
+ expect(mocks.S.lastFrom).toBe('any')
+ mount()
+ expect(lastRow().textContent).toContain('Any workout')
+ pick('This routine')
+ expect(mocks.S.lastFrom).toBe('routine')
+ })
+})
diff --git a/frontend/src/views/settings-pages.js b/frontend/src/views/settings-pages.js
index 54bc96d98..062089225 100644
--- a/frontend/src/views/settings-pages.js
+++ b/frontend/src/views/settings-pages.js
@@ -74,6 +74,7 @@ export const SEARCH = [
{ page: 'workout', title: 'Fine-tuning', icon: 'wrench', tint: 'var(--grey)', kw: 'advanced more options' },
// Fine-tuning
{ page: 'advanced', title: 'Planned sessions start from', icon: 'clipboard', tint: 'var(--green)', kw: 'start from plan last session reps carry over', opts: ['Your plan', 'Your last session'] },
+ { page: 'advanced', title: 'Last time means', icon: 'history', tint: 'var(--indigo)', kw: 'last time previous session history routine workout across every any', opts: ['This routine', 'Any workout'] },
{ page: 'advanced', title: 'Keep timing after target', icon: 'stopwatch', tint: 'var(--orange)', kw: 'timed set overtime hold duration' },
{ page: 'advanced', title: 'Weight and reps buttons', icon: 'plusCircle', tint: 'var(--green)', kw: 'steppers plus minus buttons workout controls' },
{ page: 'advanced', title: 'Drop and burst shortcuts on every set', icon: 'bolt', tint: 'var(--orange)', kw: 'drop set burst shortcuts workout controls' },
diff --git a/frontend/src/views/settings-pages.test.jsx b/frontend/src/views/settings-pages.test.jsx
index a316e4c69..d7adb6f67 100644
--- a/frontend/src/views/settings-pages.test.jsx
+++ b/frontend/src/views/settings-pages.test.jsx
@@ -296,7 +296,7 @@ describe('the pages', () => {
expect(rowTitled('Exercise animations').querySelector('.lrow-s')).toBeNull()
expect([...host.querySelectorAll('.sect-f')].some(f => /screen stays on/.test(f.textContent))).toBe(false)
mount('advanced')
- expect(titles()).toEqual(['Planned sessions start from', 'Keep timing after target', 'Weight and reps buttons',
+ expect(titles()).toEqual(['Planned sessions start from', 'Last time means', 'Keep timing after target', 'Weight and reps buttons',
'Drop and burst shortcuts on every set', 'Swipe actions', 'Exercise chips at the top', 'Muscle map at the top', 'Superset buttons in the exercise header', 'Move, swap and remove buttons below the exercise'])
})