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.

Coach: a created plan in rotation mode becomes the rotation, Undo restores the old one (#778)

Duarte Santos3775f4d1c733
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f58ab07de..fc86aeea1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,10 @@ per muscle. Settings → Workout → Fine-tuning turns it off.
devices, the one that synced last could wipe the other's chat, log and Undo history. Now they
merge message by message, and a plan you already applied on your phone no longer gets a
"nothing I would change" reply on your laptop.
+- **A Coach plan goes into your rotation** (#778). Training on a rotation, a plan from the Coach
+ used to land in the weekly schedule, which a rotation ignores, so Home kept showing your old
+ sessions. Now the rotation switches to the Coach's routines and starts over with the first
+ one, and Undo puts your old rotation back.
- **Imported weigh-ins stay put.** Weigh-ins you import (an Apple Health export, a Google Health
or Health Connect CSV, Strong, Hevy) are no longer written back to Apple Health or Health
Connect, where they landed a second time. Only weigh-ins you enter in openGym go out.
diff --git a/frontend/src/lib/coach.js b/frontend/src/lib/coach.js
index 672d673d1..54f969beb 100644
--- a/frontend/src/lib/coach.js
+++ b/frontend/src/lib/coach.js
@@ -20,6 +20,8 @@ import { deleteRoutine } from './routines.js'
import { POLICIES } from './progression.js'
import { t, tn } from './i18n.js'
import { snapshotKey } from './sync-merge.js'
+import { scheduleModeOf, startNewPass } from './rotation.js'
+import { queueOf } from './queue.js'
// Bumping this re-prompts everyone: it means what we share, or who we share it with, changed.
// 2: the training line names the session notes, which the payload carries and version 1 never
@@ -280,6 +282,11 @@ export function revertLast(s) {
s.week = clone(snap.week)
// Snapshots taken before this field existed have nothing to put back.
if (snap.dayPlanRestore) Object.assign(s.dayPlan, snap.dayPlanRestore)
+ // A created plan that took over the rotation (useInRotation) gives the old loop and its pass back.
+ if (snap.rotationRestore) {
+ s.rotation = clone(snap.rotationRestore.rotation)
+ s.queue = clone(snap.rotationRestore.queue)
+ }
// Which snapshot this used (`snap`): the sync merge keeps it off the ring when another device's
// copy still holds it, so the same Undo is not offered twice (lib/sync-merge.js mergeCoach).
appendLog(s, { kind: 'revert', at: Date.now(), proposalId: snap.proposalId, snap: snapshotKey(snap), summary: t('Reverted the last Coach changes.') })
@@ -422,14 +429,35 @@ export function applyCreatedPlan(s, proposal, { schedule } = {}) {
// Only when the week actually moved — with the switch off the old schedule still stands, and
// so do the reschedules made against it.
if (schedule) sweepDayPlan(s, todayISO())
+ const rotation = !!schedule && useInRotation(s, res.ids, bundle.name)
res.logId = appendLog(s, {
kind: 'create', at: Date.now(), proposalId: proposal.id,
summary: proposal.summary || '', routines: res.routines, iteration: proposal.iteration || 1,
- bundle: lightBundle(bundle), scheduled: !!schedule
+ bundle: lightBundle(bundle), scheduled: !!schedule, ...(rotation ? { rotation: true } : {})
})
+ res.rotation = rotation
return res
}
+/**
+ * In rotation mode Home and Plan read the loop, not the week (lib/rotation.js), so a created plan
+ * that only set the week never showed up (#778). With the schedule switch on, the loop becomes
+ * the plan's routines in the Coach's order and starts over from the first one. The Coach plans a
+ * week, not rest days, so the loop has none. The old loop and pass go on the snapshot for Undo.
+ * A planner's queue is its writer's (rotation.js OWNERSHIP) and stays as it is. Returns whether
+ * the rotation was set.
+ */
+function useInRotation(s, ids, name) {
+ if (scheduleModeOf(s) !== 'rotation' || !ids?.length) return false
+ const q = queueOf(s)
+ if (q && (!s.rotation || q.rotationId !== s.rotation.id)) return false
+ const snap = (coachOf(s).snapshots || []).at(-1)
+ if (snap) snap.rotationRestore = { rotation: clone(s.rotation ?? null), queue: clone(s.queue ?? null) }
+ s.rotation = { id: s.rotation?.id ?? uid(), sequence: [...ids], label: name || s.rotation?.label || '', at: 0 }
+ startNewPass(s)
+ return true
+}
+
/* ============================ applying a change-set ============================ */
// One implementation per allowed type. The object is the closed list on this side of the
diff --git a/frontend/src/lib/coach.test.js b/frontend/src/lib/coach.test.js
index ac76414b5..ed8a51caf 100644
--- a/frontend/src/lib/coach.test.js
+++ b/frontend/src/lib/coach.test.js
@@ -583,6 +583,87 @@ describe('created plans', () => {
})
})
+// #778: in rotation mode Home reads the loop, not the week, so a created plan that only set the
+// week never showed up until the rotation was edited by hand.
+describe('created plans in rotation mode', () => {
+ const bundle = {
+ opengym_plan: 1, name: 'Coach plan', summary: 'three days',
+ week: { 1: 'x1', 3: 'x2', 5: 'x3' },
+ routines: [
+ { id: 'x1', name: 'A', ex: [{ id: '0001', sets: 3, reps: 10, mode: 'reps' }] },
+ { id: 'x2', name: 'B', ex: [{ id: '0002', sets: 3, reps: 8, mode: 'reps' }] },
+ { id: 'x3', name: 'C', ex: [{ id: '0009', sets: 3, reps: 12, mode: 'reps' }] }
+ ],
+ customEx: []
+ }
+ const inRotation = () => {
+ const s = JSON.parse(JSON.stringify(state({ scheduleMode: 'rotation' })))
+ s.rotation = { id: 'rot', sequence: ['r1', 'rest', 'r2'], label: 'Starter', at: 2 }
+ s.queue = { ids: ['r2'], since: 1, startsOn: '2026-01-01', label: 'Starter', rotationId: 'rot' }
+ return s
+ }
+ const made = s => s.routines.slice(2).map(r => r.id)
+
+ it('puts the new routines in the rotation, in the Coach\u2019s order, from the first one', () => {
+ const s = inRotation()
+ const res = applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ expect(res.rotation).toBe(true)
+ expect(s.rotation.sequence).toEqual(made(s)) // no rest days: the Coach planned none
+ expect(s.rotation.id).toBe('rot')
+ expect(s.rotation.at).toBe(0)
+ expect(s.queue).toMatchObject({ ids: made(s), rotationId: 'rot' })
+ expect(s.coach.log.at(-1)).toMatchObject({ kind: 'create', scheduled: true, rotation: true })
+ })
+
+ it('leaves the rotation alone when the schedule switch is off', () => {
+ const s = inRotation()
+ const before = JSON.parse(JSON.stringify({ rotation: s.rotation, queue: s.queue }))
+ expect(applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: false }).rotation).toBe(false)
+ expect({ rotation: s.rotation, queue: s.queue }).toEqual(before)
+ })
+
+ it('leaves a planner\u2019s queue alone', () => {
+ const s = inRotation()
+ s.queue = { ids: ['r1'], since: 1, startsOn: '2026-01-01', label: 'From my planner' }
+ applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ expect(s.queue.ids).toEqual(['r1'])
+ expect(s.rotation.sequence).toEqual(['r1', 'rest', 'r2'])
+ })
+
+ it('starts a rotation chosen with nothing built yet', () => {
+ const s = JSON.parse(JSON.stringify(state({ scheduleMode: 'rotation' })))
+ applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ expect(s.rotation.sequence).toEqual(made(s))
+ expect(s.queue.ids).toEqual(made(s))
+ })
+
+ it('a fixed week keeps its rotation untouched', () => {
+ const s = inRotation()
+ s.scheduleMode = 'week'
+ s.queue = null
+ applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ expect(s.rotation.sequence).toEqual(['r1', 'rest', 'r2'])
+ expect(s.queue).toBeNull()
+ })
+
+ it('Undo gives the old rotation and its pass back', () => {
+ const s = inRotation()
+ const before = JSON.parse(JSON.stringify({ rotation: s.rotation, queue: s.queue }))
+ applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ expect(revertLast(s)).toBe(true)
+ expect({ rotation: s.rotation, queue: s.queue }).toEqual(before)
+ expect(s.routines.map(r => r.id)).toEqual(['r1', 'r2'])
+ })
+
+ it('Undo of a rotation started from nothing ends it again', () => {
+ const s = JSON.parse(JSON.stringify(state({ scheduleMode: 'rotation' })))
+ applyCreatedPlan(s, { id: 'p1', kind: 'create', bundle }, { schedule: true })
+ revertLast(s)
+ expect(s.rotation).toBeNull()
+ expect(s.queue).toBeNull()
+ })
+})
+
describe('validation', () => {
it('rejects an unreadable proposal rather than half-applying it', () => {
expect(() => validateProposal(null)).toThrow()
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index 4ae289a40..8ee26a25d 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -359,7 +359,8 @@ export function mergePlan(s, bundle, { schedule } = {}) {
if (ids.length) s.week[d] = ids
})
}
- return { routines: source.routines.length }
+ // `ids`: the new routines' ids in the plan's order, for a caller that puts them in a rotation.
+ return { routines: source.routines.length, ids: source.routines.map(r => ridMap[r.id]) }
}
/* ------------------------------- printable PDF ------------------------------- */
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index c9b05df4d..bcee60028 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1019,6 +1019,10 @@ export default {
'Accepted': 'مقبول',
'Expired': 'منتهي الصلاحية',
'Your week was set to this schedule.': 'تم ضبط أسبوعك على هذا الجدول.',
+ 'Use this plan in your rotation': 'استخدم هذه الخطة في التناوب',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'تحل محل الجلسات في التناوب وتبدأه من جديد بالجلسة الأولى.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'تم الاستيراد! {0} روتينات في خطتك والتناوب يبدأ من جديد بها. أراك في الجلسة القادمة.',
+ 'Your rotation was set to this plan.': 'تم ضبط التناوب على هذه الخطة.',
'Imported without changing your week.': 'تم الاستيراد دون تغيير أسبوعك.',
'This plan was imported before the app kept proposals; only its summary is left.': 'استُوردت هذه الخطة قبل أن يحتفظ التطبيق بالاقتراحات؛ لم يبقَ سوى ملخصها.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'لا شيء بعد. ستُحفظ هنا كل خطة واقتراح وملخص، سواء وافقت أم رفضت.',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 2050e509c..0fa9f03fe 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -1216,6 +1216,10 @@ export default {
'Accepted': 'গৃহীত',
'Expired': 'মেয়াদোত্তীর্ণ',
'Your week was set to this schedule.': 'আপনার সপ্তাহ এই সূচিতে সেট করা হয়েছে।',
+ 'Use this plan in your rotation': 'এই প্ল্যানটি আপনার রোটেশনে ব্যবহার করুন',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'আপনার রোটেশনের সেশনগুলো বদলে দেয় এবং প্রথমটি দিয়ে আবার শুরু করে।',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'ইমপোর্ট হয়েছে! {0}টি রুটিন আপনার প্ল্যানে আছে এবং আপনার রোটেশন এগুলো দিয়ে নতুন করে শুরু হচ্ছে। পরের সেশনে দেখা হবে।',
+ 'Your rotation was set to this plan.': 'আপনার রোটেশন এই প্ল্যানে সেট করা হয়েছে।',
'Imported without changing your week.': 'আপনার সপ্তাহ না বদলে ইমপোর্ট হয়েছে।',
'This plan was imported before the app kept proposals; only its summary is left.': 'অ্যাপ প্রস্তাব সংরক্ষণ শুরু করার আগে এই প্ল্যান ইমপোর্ট হয়েছিল; শুধু এর সারাংশ বাকি আছে।',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'এখনও কিছু নেই। প্রতিটি প্ল্যান, পরামর্শ ও ডিব্রিফ এখানে রাখা হবে, আপনি হ্যাঁ বলুন বা না।',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 9d57554de..6c12cb731 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1169,6 +1169,10 @@ export default {
'Accepted': 'Angenommen',
'Expired': 'Abgelaufen',
'Your week was set to this schedule.': 'Deine Woche wurde auf diesen Zeitplan gesetzt.',
+ 'Use this plan in your rotation': 'Diesen Plan in deiner Rotation verwenden',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Ersetzt die Einheiten deiner Rotation und startet sie mit der ersten neu.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Übernommen! {0} Routinen sind in deinem Plan und deine Rotation startet mit ihnen neu. Bis zur nächsten Einheit.',
+ 'Your rotation was set to this plan.': 'Deine Rotation wurde auf diesen Plan gesetzt.',
'Imported without changing your week.': 'Importiert, ohne deine Woche zu ändern.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Dieser Plan wurde importiert, bevor die App Vorschläge aufbewahrt hat; nur die Zusammenfassung ist übrig.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Noch nichts. Jeder Plan, Vorschlag und jede Auswertung wird hier aufbewahrt, egal ob du Ja oder Nein gesagt hast.',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 6efa4b792..ff5f27520 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Aceptado',
'Expired': 'Caducado',
'Your week was set to this schedule.': 'Tu semana se ajustó a este horario.',
+ 'Use this plan in your rotation': 'Usar este plan en tu rotación',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Reemplaza las sesiones de tu rotación y la empieza de nuevo por la primera.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': '¡Importado! {0} rutinas están en tu plan y tu rotación vuelve a empezar con ellas. Nos vemos en la próxima sesión.',
+ 'Your rotation was set to this plan.': 'Tu rotación ahora sigue este plan.',
'Imported without changing your week.': 'Importado sin cambiar tu semana.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Este plan se importó antes de que la app guardara propuestas; solo queda su resumen.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Nada aún. Cada plan, sugerencia y evaluación se guardará aquí, digas sí o no.',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 8f63e2a9b..89dd1f419 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Accepté',
'Expired': 'Expiré',
'Your week was set to this schedule.': 'Ta semaine a été réglée sur ce planning.',
+ 'Use this plan in your rotation': 'Utiliser ce plan dans ta rotation',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Remplace les séances de ta rotation et la relance depuis la première.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importé ! {0} routines sont dans ton plan et ta rotation repart avec elles. À la prochaine séance.',
+ 'Your rotation was set to this plan.': 'Ta rotation suit maintenant ce plan.',
'Imported without changing your week.': 'Importé sans changer ta semaine.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Ce plan a été importé avant que l’app ne conserve les propositions ; il ne reste que son résumé.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Rien pour l’instant. Chaque plan, suggestion et bilan sera gardé ici, que tu aies dit oui ou non.',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 2b1d8a725..74d8f4bff 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'स्वीकृत',
'Expired': 'समाप्त',
'Your week was set to this schedule.': 'आपका सप्ताह इस शेड्यूल पर सेट हो गया।',
+ 'Use this plan in your rotation': 'इस योजना को अपने रोटेशन में इस्तेमाल करें',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'आपके रोटेशन के सत्रों को बदल देता है और उसे पहले सत्र से फिर शुरू करता है।',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'आयात हो गया! {0} रूटीन आपकी योजना में हैं और आपका रोटेशन इन्हीं से फिर शुरू होता है। अगले सत्र में मिलते हैं।',
+ 'Your rotation was set to this plan.': 'आपका रोटेशन इस योजना पर सेट कर दिया गया।',
'Imported without changing your week.': 'सप्ताह बदले बिना आयात किया।',
'This plan was imported before the app kept proposals; only its summary is left.': 'यह प्लान ऐप द्वारा प्रस्ताव सहेजने से पहले आयात हुआ था; सिर्फ़ इसका सारांश बचा है।',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'अभी कुछ नहीं। हर प्लान, सुझाव और समीक्षा यहाँ रखी जाएगी, चाहे आपने हाँ कहा हो या ना।',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 1130ea79e..482c07806 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1227,6 +1227,10 @@ export default {
'Accepted': 'Elfogadva',
'Expired': 'Lejárt',
'Your week was set to this schedule.': 'A heted erre az ütemezésre lett állítva.',
+ 'Use this plan in your rotation': 'Ez a terv legyen a rotációdban',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Lecseréli a rotációd edzéseit, és az elsőtől újraindítja.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importálva! {0} rutin került a tervedbe, és a rotációd velük indul újra. Találkozunk a következő edzésen.',
+ 'Your rotation was set to this plan.': 'A rotációd most ezt a tervet követi.',
'Imported without changing your week.': 'Importálva a heted módosítása nélkül.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Ez a terv még azelőtt lett importálva, hogy az app megőrizte volna a javaslatokat; csak az összefoglalója maradt meg.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Még semmi. Minden terv, javaslat és kiértékelés itt lesz megőrizve, akár igent, akár nemet mondtál.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index e162c9520..d5e82c343 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Accettato',
'Expired': 'Scaduto',
'Your week was set to this schedule.': 'La tua settimana è stata impostata su questo programma.',
+ 'Use this plan in your rotation': 'Usa questo piano nella tua rotazione',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Sostituisce le sessioni della tua rotazione e la fa ripartire dalla prima.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importato! {0} routine sono nel tuo piano e la rotazione riparte con loro. Ci vediamo alla prossima sessione.',
+ 'Your rotation was set to this plan.': 'La tua rotazione ora segue questo piano.',
'Imported without changing your week.': 'Importato senza cambiare la tua settimana.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Questo piano è stato importato prima che l’app conservasse le proposte; resta solo il riassunto.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Ancora niente. Ogni piano, suggerimento e valutazione verrà conservato qui, che tu abbia detto sì o no.',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 47436e9d0..0075b4e83 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': '수락됨',
'Expired': '만료됨',
'Your week was set to this schedule.': '주간 일정이 이 스케줄로 설정되었습니다.',
+ 'Use this plan in your rotation': '이 계획을 로테이션에 사용',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': '로테이션의 세션을 바꾸고 첫 번째 세션부터 다시 시작해요.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': '가져왔어요! 루틴 {0}개가 계획에 들어갔고 로테이션도 이 루틴들로 다시 시작해요. 다음 세션에서 봐요.',
+ 'Your rotation was set to this plan.': '로테이션이 이 계획으로 바뀌었어요.',
'Imported without changing your week.': '주간 일정 변경 없이 가져왔습니다.',
'This plan was imported before the app kept proposals; only its summary is left.': '이 플랜은 앱이 제안을 보관하기 전에 가져온 것이라 요약만 남아 있습니다.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': '아직 없어요. 모든 플랜, 제안, 평가가 수락 여부와 상관없이 여기에 보관돼요.',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 46f511150..ebd5ce17d 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Przyjęte',
'Expired': 'Wygasło',
'Your week was set to this schedule.': 'Twój tydzień został ustawiony według tego harmonogramu.',
+ 'Use this plan in your rotation': 'Użyj tego planu w rotacji',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Zastępuje treningi w rotacji i zaczyna ją od pierwszego.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': { one: 'Zaimportowano {0} plan treningowy, a rotacja zaczyna się od nowa. Do zobaczenia na następnym treningu.', few: 'Zaimportowano {0} plany treningowe, a rotacja zaczyna się od nich od nowa. Do zobaczenia na następnym treningu.', many: 'Zaimportowano {0} planów treningowych, a rotacja zaczyna się od nich od nowa. Do zobaczenia na następnym treningu.', other: 'Zaimportowano {0} planów treningowych, a rotacja zaczyna się od nich od nowa. Do zobaczenia na następnym treningu.' },
+ 'Your rotation was set to this plan.': 'Twoja rotacja korzysta teraz z tego planu.',
'Imported without changing your week.': 'Zaimportowano bez zmiany tygodnia.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Ten plan zaimportowano, zanim aplikacja zachowywała propozycje; zostało tylko podsumowanie.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Jeszcze nic. Każdy plan, sugestia i podsumowanie zostaną tu zachowane, niezależnie od tego, czy powiesz tak czy nie.',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index a6d75c8e2..4d43c5c73 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -661,6 +661,10 @@ export const PT_BR_OVERRIDES = {
'Accepted': 'Aceita',
'Expired': 'Expirado',
'Your week was set to this schedule.': 'Sua semana ficou com esta programação.',
+ 'Use this plan in your rotation': 'Usar este plano na sua rotação',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Substitui as sessões da sua rotação e recomeça pela primeira.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importado! {0} rotinas estão no seu plano e sua rotação recomeça com elas. Até o próximo treino.',
+ 'Your rotation was set to this plan.': 'Sua rotação agora segue este plano.',
'Imported without changing your week.': 'Importado sem mudar sua semana.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Este plano foi importado antes de o app guardar propostas; só sobrou o resumo.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Nada ainda. Cada plano, sugestão e balanço fica guardado aqui, tenha você dito sim ou não.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index e0e4b845d..7b7722291 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Aceite',
'Expired': 'Expirado',
'Your week was set to this schedule.': 'A tua semana ficou com este horário.',
+ 'Use this plan in your rotation': 'Usar este plano na tua rotação',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Substitui as sessões da tua rotação e recomeça-a pela primeira.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importado! {0} rotinas estão no teu plano e a tua rotação recomeça com elas. Até à próxima sessão.',
+ 'Your rotation was set to this plan.': 'A tua rotação passou a seguir este plano.',
'Imported without changing your week.': 'Importado sem alterar a tua semana.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Este plano foi importado antes de a app guardar propostas; só resta o resumo.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Ainda nada. Cada plano, sugestão e balanço fica guardado aqui, quer digas sim ou não.',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 42ff62b0b..6e0e4f818 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1128,6 +1128,10 @@ export default {
'Accepted': 'Принято',
'Expired': 'Истекло',
'Your week was set to this schedule.': 'Ваша неделя настроена по этому расписанию.',
+ 'Use this plan in your rotation': 'Использовать этот план в ротации',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Заменяет тренировки в ротации и запускает её заново с первой.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Импортировано! {0} программ в вашем плане, ротация начинается с них заново. До встречи на следующей тренировке.',
+ 'Your rotation was set to this plan.': 'Ротация теперь идёт по этому плану.',
'Imported without changing your week.': 'Импортировано без изменения недели.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Этот план импортирован до того, как приложение стало хранить предложения; осталось только резюме.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Пока ничего. Каждый план, предложение и разбор будут храниться здесь, ответили вы «да» или «нет».',
diff --git a/frontend/src/locales/sv.js b/frontend/src/locales/sv.js
index c769afc01..ede066bea 100644
--- a/frontend/src/locales/sv.js
+++ b/frontend/src/locales/sv.js
@@ -1170,6 +1170,10 @@ export default {
'Accepted': 'Godkänt',
'Expired': 'Utgånget',
'Your week was set to this schedule.': 'Din vecka ställdes in efter det här schemat.',
+ 'Use this plan in your rotation': 'Använd den här planen i din rotation',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Ersätter passen i din rotation och börjar om den från det första.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Importerat! {0} rutiner finns i din plan och din rotation börjar om med dem. Vi ses nästa pass.',
+ 'Your rotation was set to this plan.': 'Din rotation följer nu den här planen.',
'Imported without changing your week.': 'Importerat utan att ändra din vecka.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Den här planen importerades innan appen sparade förslag; bara sammanfattningen finns kvar.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Inget än. Varje plan, förslag och genomgång sparas här, oavsett om du sa ja eller nej.',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 3285edee9..f952d78f8 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1235,6 +1235,10 @@ export default {
'Accepted': 'ยอมรับแล้ว',
'Expired': 'หมดอายุแล้ว',
'Your week was set to this schedule.': 'สัปดาห์ของคุณถูกตั้งค่าเป็นตารางนี้',
+ 'Use this plan in your rotation': 'ใช้แผนนี้ในการหมุนเวียนของคุณ',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'แทนที่เซสชันในการหมุนเวียนของคุณ แล้วเริ่มใหม่จากเซสชันแรก',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'นำเข้าแล้ว! {0} รูทีนอยู่ในแผนของคุณ และการหมุนเวียนเริ่มใหม่ด้วยรูทีนเหล่านี้ เจอกันเซสชันหน้า',
+ 'Your rotation was set to this plan.': 'ตั้งการหมุนเวียนของคุณเป็นแผนนี้แล้ว',
'Imported without changing your week.': 'นำเข้าโดยไม่เปลี่ยนสัปดาห์ของคุณ',
'This plan was imported before the app kept proposals; only its summary is left.': 'แผนนี้ถูกนำเข้าก่อนที่แอปจะเก็บข้อเสนอ เหลือเพียงสรุปเท่านั้น',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'ยังไม่มีอะไร ทุกแผน ข้อเสนอ และสรุปผลจะเก็บไว้ที่นี่ ไม่ว่าคุณจะตอบรับหรือปฏิเสธ',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 42145e256..9e1afaf4a 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': 'Kabul edildi',
'Expired': 'Süresi doldu',
'Your week was set to this schedule.': 'Haftan bu programa göre ayarlandı.',
+ 'Use this plan in your rotation': 'Bu planı dönüşümlü programında kullan',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Dönüşümlü programındaki antrenmanların yerini alır ve ilkinden yeniden başlatır.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'İçe aktarıldı! {0} rutin planında ve dönüşümlü programın onlarla yeniden başlıyor. Bir sonraki antrenmanda görüşürüz.',
+ 'Your rotation was set to this plan.': 'Dönüşümlü programın bu plana ayarlandı.',
'Imported without changing your week.': 'Haftan değiştirilmeden içe aktarıldı.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Bu plan, uygulama önerileri saklamaya başlamadan önce içe aktarıldı; sadece özeti kaldı.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Henüz bir şey yok. Her plan, öneri ve değerlendirme, evet de desen hayır da desen burada saklanacak.',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 99d899c98..17727da7e 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -953,6 +953,10 @@ export default {
'Accepted': 'Прийнято',
'Expired': 'Спливло',
'Your week was set to this schedule.': 'Твій тиждень налаштовано за цим розкладом.',
+ 'Use this plan in your rotation': 'Використати цей план у ротації',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': 'Замінює тренування в ротації і запускає її знову з першого.',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': 'Імпортовано! {0} програм у твоєму плані, ротація починається з них заново. До зустрічі на наступному тренуванні.',
+ 'Your rotation was set to this plan.': 'Ротація тепер іде за цим планом.',
'Imported without changing your week.': 'Імпортовано без зміни тижня.',
'This plan was imported before the app kept proposals; only its summary is left.': 'Цей план імпортовано до того, як застосунок почав зберігати пропозиції; лишився тільки його підсумок.',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': 'Поки нічого. Кожен план, пропозиція й розбір зберігатимуться тут, незалежно від того, погодився ти чи ні.',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 714d5c257..bfbbeb2cc 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1141,6 +1141,10 @@ export default {
'Accepted': '已接受',
'Expired': '已過期',
'Your week was set to this schedule.': '你的每週排程已套用此規劃。',
+ 'Use this plan in your rotation': '在輪替中使用這份計畫',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': '取代輪替中的訓練,並從第一個重新開始。',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': '已匯入!{0} 份課表已加入你的計畫,輪替也從它們重新開始。下次訓練見。',
+ 'Your rotation was set to this plan.': '你的輪替已改成這份計畫。',
'Imported without changing your week.': '已匯入,但維持原有每週排程不變。',
'This plan was imported before the app kept proposals; only its summary is left.': '此計畫在系統開始保存提議歷程前即已匯入,僅保留摘要。',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': '目前還沒有內容。每個計畫、建議與檢討都會保存在這裡,無論你接受或拒絕。',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 849d4604b..bea05f86f 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1149,6 +1149,10 @@ export default {
'Accepted': '已采纳',
'Expired': '已过期',
'Your week was set to this schedule.': '你的一周已按此安排设置。',
+ 'Use this plan in your rotation': '在轮换中使用这个计划',
+ 'Replaces the sessions in your rotation and starts it over with the first one.': '替换轮换中的训练,并从第一个重新开始。',
+ 'Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.': '已导入!{0} 个训练日已加入你的计划,轮换也从它们重新开始。下次训练见。',
+ 'Your rotation was set to this plan.': '你的轮换已改为这个计划。',
'Imported without changing your week.': '已导入,未更改你的一周安排。',
'This plan was imported before the app kept proposals; only its summary is left.': '此计划在应用开始保存建议之前导入,只剩下摘要。',
'Nothing yet. Every plan, suggestion and debrief will be kept here, whether you said yes or no.': '还没有内容。每个计划、建议和复盘都会保存在这里,无论你说了好还是不。',
diff --git a/frontend/src/views/CoachChat.jsx b/frontend/src/views/CoachChat.jsx
index 3a8e1b496..4a90eac31 100644
--- a/frontend/src/views/CoachChat.jsx
+++ b/frontend/src/views/CoachChat.jsx
@@ -23,6 +23,7 @@ import { exLine } from '../lib/history.js'
import { speedUnitOf } from '../lib/speed.js'
import { DEMO } from '../lib/demo.js'
import { MOBILE } from '../lib/mobile.js'
+import { scheduleModeOf } from '../lib/rotation.js'
import ChatInput from '../components/ChatInput.jsx'
import {
coachAvailable, hasConsent, emptyCoach, appendChat, recordTiming, estimateMs, profileLines,
@@ -335,7 +336,9 @@ function PlanCard({ p, S, update, toast, nav, refresh }) {
update(s => {
const res = applyCreatedPlan(s, p, { schedule })
n = res?.routines?.length || b.routines.length
- appendChat(s, { role: 'coach', kind: 'applied', ref: res.logId, text: schedule
+ appendChat(s, { role: 'coach', kind: 'applied', ref: res.logId, text: res.rotation
+ ? t('Imported! {0} routines are in your plan and your rotation starts over with them. See you at the next session.', n)
+ : schedule
? t('Imported! {0} routines are in your plan and your week is set. See you at the next session.', n)
: t('Imported! {0} routines are in your plan. Your week is unchanged; schedule them whenever you like.', n) })
})
@@ -372,7 +375,10 @@ function PlanCard({ p, S, update, toast, nav, refresh }) {
{r && <RoutineBlock r={r} unit={S.unit} speedUnit={speedUnitOf(S)} />}
<div className="pcard-row">
- <span className="lrow-m"><span className="lrow-t">{t('Use this weekly schedule')}</span><span className="lrow-s">{t('Replaces your current week. Days this plan leaves empty become rest days.')}</span></span>
+ {/* In rotation mode the plan goes into the loop, which is what Home reads (#778). */}
+ {scheduleModeOf(S) === 'rotation'
+ ? <span className="lrow-m"><span className="lrow-t">{t('Use this plan in your rotation')}</span><span className="lrow-s">{t('Replaces the sessions in your rotation and starts it over with the first one.')}</span></span>
+ : <span className="lrow-m"><span className="lrow-t">{t('Use this weekly schedule')}</span><span className="lrow-s">{t('Replaces your current week. Days this plan leaves empty become rest days.')}</span></span>}
<Switch checked={schedule} onChange={setSchedule} />
</div>
<div className="pcard-note">{t('The Coach is not a doctor or a physiotherapist. If something hurts, ask a professional.')}</div>
@@ -669,7 +675,7 @@ function ProposalDetail({ entry, S }) {
{b.routines.map((x, i) => <button key={x.id || i} className={'pcard-tab' + (i === tab ? ' on' : '')} onClick={() => setTab(i)}><Icon name={glyphOf(x.emoji)} />{x.name}</button>)}
</div>}
{r && <RoutineBlock r={r} unit={S.unit} speedUnit={speedUnitOf(S)} />}
- <p className="pcard-sum" style={{ fontSize: 13 }}>{entry.scheduled ? t('Your week was set to this schedule.') : t('Imported without changing your week.')}</p>
+ <p className="pcard-sum" style={{ fontSize: 13 }}>{entry.rotation ? t('Your rotation was set to this plan.') : entry.scheduled ? t('Your week was set to this schedule.') : t('Imported without changing your week.')}</p>
</>}
{kind === 'create' && !b && <p className="pcard-sum">{t('This plan was imported before the app kept proposals; only its summary is left.')}</p>}