Bar weight: 'No bar' for a Smith machine that carries its own carriage (#138)
Typing 0 in the bar field meant 'clear the override', so it snapped straight back to the 9 kg default and the plate math, the drop-set steps and the warm-up ramp all counted a bar that is not in your hands. A stored 0 is now a value of its own — no bar — and the key being absent is what means 'use the default for this bar type'. A switch in the bar-weight editor sets it; turning it off gives the default back. The chip in a session drops the bar half and shows the plate math alone, which with no bar is simply half of what you logged. Two existing tests asserted the old meaning of 0 and are updated: that is the behaviour change.
This commit is contained in:
1 parent
82646843c6
commit
22c2ff9d2c
19 files changed
+179
-14
No files matched your search
@@ -0,0 +1,37 @@
|
||||
// Issue #138: a Smith machine that counterbalances its carriage puts nothing in your hands, but
|
||||
// 0 in the bar field meant "clear the override" and snapped back to the 9 kg default — so the
|
||||
// plate math and the drop-set steps were computed from a bar that is not there.
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { barWeightFor, hasBarOverride, isNoBar, plateSplit, defaultBarWeight } from './bar.js'
|
||||
|
||||
const smith = { id: 'sm', eq: 'smith machine' }
|
||||
const bb = { id: 'bb', eq: 'barbell' }
|
||||
const S = over => ({ unit: 'kg', barWeights: { ...over } })
|
||||
|
||||
describe('no bar at all', () => {
|
||||
it('keeps a stored 0 instead of falling back to the bar type default', () => {
|
||||
expect(barWeightFor(S({ sm: 0 }), smith)).toBe(0)
|
||||
expect(defaultBarWeight('smith machine', 'kg')).toBe(9)
|
||||
expect(barWeightFor(S({}), smith)).toBe(9) // no entry still means "use the default"
|
||||
})
|
||||
|
||||
it('tells "no bar" apart from "nothing set"', () => {
|
||||
expect(isNoBar(S({ sm: 0 }), 'sm')).toBe(true)
|
||||
expect(isNoBar(S({ sm: 15 }), 'sm')).toBe(false)
|
||||
expect(isNoBar(S({}), 'sm')).toBe(false)
|
||||
expect(hasBarOverride(S({ sm: 0 }), 'sm')).toBe(true)
|
||||
expect(hasBarOverride(S({}), 'sm')).toBe(false)
|
||||
})
|
||||
|
||||
it('counts every plate when there is no bar', () => {
|
||||
expect(plateSplit(100, 0)).toBe(50)
|
||||
expect(plateSplit(100, 20)).toBe(40)
|
||||
expect(plateSplit(0, 0)).toBe(null)
|
||||
expect(plateSplit(100, null)).toBe(null) // not a bar exercise at all
|
||||
})
|
||||
|
||||
it('leaves an ordinary barbell alone', () => {
|
||||
expect(barWeightFor(S({ bb: 25 }), bb)).toBe(25)
|
||||
expect(barWeightFor(S({}), bb)).toBe(20)
|
||||
})
|
||||
})
|
||||
+18
-3
@@ -30,8 +30,20 @@ export const usesBar = exOrId => BAR_EQ.has(exOf(exOrId)?.eq)
|
||||
export const defaultBarWeight = (eq, unit) =>
|
||||
(unit === 'lb' ? DEFAULT_BAR_LB : DEFAULT_BAR_KG)[eq] ?? null
|
||||
|
||||
/** True when the user has set their own bar weight for this exercise. */
|
||||
export const hasBarOverride = (S, exId) => ((S?.barWeights || {})[exId] || 0) > 0
|
||||
/**
|
||||
* A stored 0 is "no bar", not "unset" (issue #138). Smith machines that counterbalance their
|
||||
* carriage put nothing in your hands, so the plate math and the drop-set steps have to start
|
||||
* from the weight you logged, not from a 9 kg bar that is not there. The key being absent is
|
||||
* what means "use the default for this bar type" — which is why the editor clears the key
|
||||
* rather than writing a 0 when you ask for the default back.
|
||||
*/
|
||||
export const isNoBar = (S, exId) => (S?.barWeights || {})[exId] === 0
|
||||
|
||||
/** True when the user has set their own bar weight for this exercise — including "no bar". */
|
||||
export const hasBarOverride = (S, exId) => {
|
||||
const own = (S?.barWeights || {})[exId]
|
||||
return own === 0 || own > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Effective bar weight for one exercise, in the profile unit: the explicit
|
||||
@@ -42,6 +54,7 @@ export function barWeightFor(S, exOrId) {
|
||||
const ex = exOf(exOrId)
|
||||
if (!BAR_EQ.has(ex?.eq)) return null
|
||||
const own = (S?.barWeights || {})[ex.id]
|
||||
if (own === 0) return 0
|
||||
if (own > 0) return own
|
||||
return defaultBarWeight(ex.eq, S?.unit)
|
||||
}
|
||||
@@ -51,6 +64,8 @@ export function barWeightFor(S, exOrId) {
|
||||
* sensible to show — a missing number, or a total at or below the bar itself.
|
||||
*/
|
||||
export function plateSplit(total, bar) {
|
||||
if (!(total > 0) || !(bar > 0) || total <= bar) return null
|
||||
// `bar` of 0 is a real answer, not a missing one: with no bar every kilo you logged is on the
|
||||
// ends, so the split is simply half of it (issue #138).
|
||||
if (!(total > 0) || !(bar >= 0) || bar === null || bar === undefined || total <= bar) return null
|
||||
return Math.round(((total - bar) / 2) * 100) / 100
|
||||
}
|
||||
@@ -55,12 +55,15 @@ describe('barWeightFor', () => {
|
||||
expect(hasBarOverride(S, barbell)).toBe(false)
|
||||
})
|
||||
|
||||
test('a cleared (deleted or zeroed) override falls back to the default', () => {
|
||||
test('a deleted override falls back to the default, but a stored 0 is "no bar"', () => {
|
||||
const S = { unit: 'kg', barWeights: { [ez]: 12.5 } }
|
||||
delete S.barWeights[ez]
|
||||
expect(barWeightFor(S, ez)).toBe(10)
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(10)
|
||||
expect(hasBarOverride({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(false)
|
||||
// Changed with issue #138: 0 used to mean "clear this override". It now means the exercise
|
||||
// has no bar (a counterbalanced Smith carriage), which is a value of its own — the editor
|
||||
// deletes the key to ask for the default back.
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(0)
|
||||
expect(hasBarOverride({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(true)
|
||||
})
|
||||
|
||||
test('is null for anything without a bar', () => {
|
||||
@@ -86,7 +89,7 @@ describe('plateSplit', () => {
|
||||
expect(plateSplit(20, 20)).toBe(null) // bar only
|
||||
expect(plateSplit(15, 20)).toBe(null) // below the bar
|
||||
expect(plateSplit(0, 20)).toBe(null)
|
||||
expect(plateSplit(100, 0)).toBe(null)
|
||||
// 100 with no bar is 50 a side, not "nothing to show" (issue #138) — see bar-nobar.test.js
|
||||
expect(plateSplit(null, 20)).toBe(null)
|
||||
expect(plateSplit(100, null)).toBe(null)
|
||||
expect(plateSplit(undefined, undefined)).toBe(null)
|
||||
|
||||
@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(645)
|
||||
expect(inherited).toHaveLength(653)
|
||||
expect(inherited).toHaveLength(660)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('d71601df55e68431de99090a6c9c4766eaaa189baf92e0e696f31d2fd2739a88')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('a2027d64b3944dcef644b11b4d9688b88fe5cff0693acf04c73f0667e2b86825')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -335,6 +335,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Der Bildschirm bleibt an, solange ein Workout läuft — so musst du zwischen den Sätzen nicht entsperren.',
|
||||
'Weight unit': 'Gewichtseinheit',
|
||||
'Week starts on': 'Woche beginnt am',
|
||||
'Weight decimals': 'Nachkommastellen',
|
||||
'How precisely weights are shown.': 'Wie genau Gewichte angezeigt werden.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Pausen-Timer',
|
||||
'Sounds': 'Töne',
|
||||
'Flash screen when timer ends': 'Bildschirm bei Timer-Ende blinken lassen',
|
||||
@@ -1160,6 +1164,9 @@ export default {
|
||||
'Bar ({0})': 'Stange ({0})',
|
||||
'Bar {0}': 'Stange {0}',
|
||||
'Default for this bar type.': 'Standard für diesen Stangentyp.',
|
||||
'No bar': 'Keine Stange',
|
||||
'The weight you log is all plates.': 'Das eingetragene Gewicht sind nur Scheiben.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Scheiben werden ab 0 gerechnet — ausschalten fuer den Standard ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Auf 0 stellen, um zum Standard ({0}) zurückzukehren.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Gilt überall für diese Übung, nicht nur in diesem Plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Eingetragen wird weiterhin das Gesamtgewicht — die Stange zählt nur für die Scheiben-Rechnung pro Seite.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'La pantalla se mantiene encendida mientras hay un entrenamiento en curso, así no tienes que desbloquear el móvil entre series.',
|
||||
'Weight unit': 'Unidad de peso',
|
||||
'Week starts on': 'La semana empieza el',
|
||||
'Weight decimals': 'Decimales del peso',
|
||||
'How precisely weights are shown.': 'Con qué precisión se muestran los pesos.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Temporizador de descanso',
|
||||
'Sounds': 'Sonidos',
|
||||
'Flash screen when timer ends': 'Hacer parpadear la pantalla al finalizar el temporizador',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Barra ({0})',
|
||||
'Bar {0}': 'Barra {0}',
|
||||
'Default for this bar type.': 'Valor por defecto para este tipo de barra.',
|
||||
'No bar': 'Sin barra',
|
||||
'The weight you log is all plates.': 'El peso que registras son solo discos.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Los discos se cuentan desde 0 — desactívalo para el valor por defecto ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Pon 0 para volver al valor por defecto ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Se aplica a este ejercicio en todas partes, no solo en este plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Sigues registrando el peso total — la barra solo se usa para calcular los discos por lado.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'L’écran reste allumé tant qu’une séance est en cours, pas besoin de déverrouiller ton téléphone entre les séries.',
|
||||
'Weight unit': 'Unité de poids',
|
||||
'Week starts on': 'La semaine commence le',
|
||||
'Weight decimals': 'Décimales du poids',
|
||||
'How precisely weights are shown.': 'Avec quelle précision les poids sont affichés.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Minuteur de repos',
|
||||
'Sounds': 'Sons',
|
||||
'Flash screen when timer ends': 'Faire clignoter l’écran à la fin du minuteur',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Barre ({0})',
|
||||
'Bar {0}': 'Barre {0}',
|
||||
'Default for this bar type.': 'Valeur par défaut pour ce type de barre.',
|
||||
'No bar': 'Sans barre',
|
||||
'The weight you log is all plates.': 'Le poids que tu notes, ce sont les disques.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Les disques sont comptés à partir de 0 — désactive pour la valeur par défaut ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Mets 0 pour revenir à la valeur par défaut ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'S’applique à cet exercice partout, pas seulement dans ce plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Tu enregistres toujours le poids total — la barre ne sert qu’au calcul des disques par côté.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'वर्कआउट चलने के दौरान स्क्रीन चालू रहती है, ताकि सेट के बीच फ़ोन अनलॉक न करना पड़े।',
|
||||
'Weight unit': 'वज़न की इकाई',
|
||||
'Week starts on': 'सप्ताह शुरू होता है',
|
||||
'Weight decimals': 'वज़न के दशमलव',
|
||||
'How precisely weights are shown.': 'वज़न कितनी सटीकता से दिखें।',
|
||||
'0.5': '0.5',
|
||||
'0.25': '0.25',
|
||||
'Rest timer': 'आराम टाइमर',
|
||||
'Sounds': 'ध्वनियाँ',
|
||||
'Flash screen when timer ends': 'टाइमर खत्म होने पर स्क्रीन फ्लैश करें',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'बार ({0})',
|
||||
'Bar {0}': 'बार {0}',
|
||||
'Default for this bar type.': 'इस तरह की बार का डिफ़ॉल्ट मान।',
|
||||
'No bar': 'कोई बार नहीं',
|
||||
'The weight you log is all plates.': 'आप जो वज़न दर्ज करते हैं वह पूरा प्लेट है।',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'प्लेट 0 से गिनी जाती हैं — डिफ़ॉल्ट ({0}) के लिए इसे बंद करें।',
|
||||
'Set to 0 to go back to the default ({0}).': 'डिफ़ॉल्ट ({0}) पर लौटने के लिए 0 सेट करें।',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'यह इस एक्सरसाइज़ पर हर जगह लागू होता है, सिर्फ़ इसी प्लान पर नहीं।',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — बार सिर्फ़ हर तरफ़ की प्लेट गिनती में काम आता है।',
|
||||
|
||||
@@ -327,6 +327,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'A képernyő edzés közben bekapcsolva marad, így sorozatok között nem kell feloldanod a telefonod.',
|
||||
'Weight unit': 'Súlymértékegység',
|
||||
'Week starts on': 'A hét kezdőnapja',
|
||||
'Weight decimals': 'Súly tizedesjegyei',
|
||||
'How precisely weights are shown.': 'Milyen pontosan jelenjen meg a súly.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Pihenő időzítő',
|
||||
'Sounds': 'Hangok',
|
||||
'Data': 'Adatok',
|
||||
@@ -805,6 +809,9 @@ export default {
|
||||
'Bar ({0})': 'Rúd ({0})',
|
||||
'Bar {0}': 'Rúd {0}',
|
||||
'Default for this bar type.': 'Alapérték ehhez a rúdtípushoz.',
|
||||
'No bar': 'Nincs rúd',
|
||||
'The weight you log is all plates.': 'A beírt súly csak a tárcsák.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'A tárcsák 0-tól számítanak — kapcsold ki az alapértékhez ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Állítsd 0-ra az alapérték ({0}) visszaállításához.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Mindenhol érvényes erre a gyakorlatra, nem csak ebben a tervben.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Továbbra is a teljes súlyt rögzíted — a rúd csak az oldalankénti tárcsaszámításhoz kell.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Lo schermo resta acceso mentre un allenamento è in corso, così non devi sbloccare il telefono tra una serie e l’altra.',
|
||||
'Weight unit': 'Unità di peso',
|
||||
'Week starts on': 'La settimana inizia il',
|
||||
'Weight decimals': 'Decimali del peso',
|
||||
'How precisely weights are shown.': 'Con quanta precisione vengono mostrati i pesi.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Timer di riposo',
|
||||
'Sounds': 'Suoni',
|
||||
'Flash screen when timer ends': 'Fai lampeggiare lo schermo alla fine del timer',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Bilanciere ({0})',
|
||||
'Bar {0}': 'Bilanciere {0}',
|
||||
'Default for this bar type.': 'Valore predefinito per questo tipo di bilanciere.',
|
||||
'No bar': 'Senza bilanciere',
|
||||
'The weight you log is all plates.': 'Il peso che registri sono solo i dischi.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'I dischi si contano da 0 — disattiva per il valore predefinito ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Imposta 0 per tornare al valore predefinito ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Vale per questo esercizio ovunque, non solo in questo piano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Registri comunque il peso totale — il bilanciere serve solo al calcolo dei dischi per lato.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': '운동이 진행되는 동안 화면이 켜져 있어 세트 사이에 잠금을 해제할 필요가 없습니다.',
|
||||
'Weight unit': '무게 단위',
|
||||
'Week starts on': '주 시작 요일',
|
||||
'Weight decimals': '무게 소수점',
|
||||
'How precisely weights are shown.': '무게를 얼마나 정밀하게 표시할지.',
|
||||
'0.5': '0.5',
|
||||
'0.25': '0.25',
|
||||
'Rest timer': '휴식 타이머',
|
||||
'Sounds': '소리',
|
||||
'Flash screen when timer ends': '타이머 종료 시 화면 깜박임',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': '바 ({0})',
|
||||
'Bar {0}': '바 {0}',
|
||||
'Default for this bar type.': '이 바 종류의 기본값입니다.',
|
||||
'No bar': '바 없음',
|
||||
'The weight you log is all plates.': '기록하는 무게가 전부 원판입니다.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': '원판을 0부터 계산합니다 — 기본값({0})으로 돌리려면 끄세요.',
|
||||
'Set to 0 to go back to the default ({0}).': '0으로 두면 기본값({0})으로 돌아갑니다.',
|
||||
'Applies to this exercise everywhere, not just this plan.': '이 플랜만이 아니라 어디서든 이 운동에 적용됩니다.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '기록은 여전히 총 무게입니다 — 바 무게는 한쪽에 끼울 원판 계산에만 쓰입니다.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Ekran pozostaje włączony w trakcie treningu, więc nie musisz odblokowywać telefonu między seriami.',
|
||||
'Weight unit': 'Jednostka wagi',
|
||||
'Week starts on': 'Tydzień zaczyna się w',
|
||||
'Weight decimals': 'Miejsca dziesiętne ciężaru',
|
||||
'How precisely weights are shown.': 'Jak dokładnie pokazywać ciężary.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Minutnik przerwy',
|
||||
'Sounds': 'Dźwięki',
|
||||
'Flash screen when timer ends': 'Migaj ekranem po zakończeniu minutnika',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Gryf ({0})',
|
||||
'Bar {0}': 'Gryf {0}',
|
||||
'Default for this bar type.': 'Wartość domyślna dla tego typu gryfu.',
|
||||
'No bar': 'Bez gryfu',
|
||||
'The weight you log is all plates.': 'Zapisany ciężar to same talerze.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Talerze liczone od 0 — wyłącz, aby wrócić do domyślnego ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Ustaw 0, aby wrócić do wartości domyślnej ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Dotyczy tego ćwiczenia wszędzie, nie tylko w tym planie.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Nadal zapisujesz ciężar całkowity — gryf służy tylko do wyliczenia talerzy na stronę.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'O ecrã fica ligado enquanto há um treino a decorrer, para não teres de desbloquear o telemóvel entre séries.',
|
||||
'Weight unit': 'Unidade de peso',
|
||||
'Week starts on': 'Início da semana',
|
||||
'Weight decimals': 'Casas decimais do peso',
|
||||
'How precisely weights are shown.': 'Com que precisão os pesos são mostrados.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Temporizador de descanso',
|
||||
'Sounds': 'Sons',
|
||||
'Flash screen when timer ends': 'Piscar o ecrã quando o temporizador terminar',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Barra ({0})',
|
||||
'Bar {0}': 'Barra {0}',
|
||||
'Default for this bar type.': 'Predefinição para este tipo de barra.',
|
||||
'No bar': 'Sem barra',
|
||||
'The weight you log is all plates.': 'O peso que registas são só discos.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Os discos contam a partir de 0 — desliga para o valor predefinido ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Coloca 0 para voltar à predefinição ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Aplica-se a este exercício em todo o lado, não só neste plano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Continuas a registar o peso total — a barra só conta para o cálculo dos discos por lado.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Экран не гаснет, пока идёт тренировка, — не нужно разблокировать телефон между подходами.',
|
||||
'Weight unit': 'Единица веса',
|
||||
'Week starts on': 'Неделя начинается с',
|
||||
'Weight decimals': 'Знаки после запятой',
|
||||
'How precisely weights are shown.': 'Насколько точно показывать вес.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Таймер отдыха',
|
||||
'Sounds': 'Звуки',
|
||||
'Flash screen when timer ends': 'Мигать экраном по окончании таймера',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Гриф ({0})',
|
||||
'Bar {0}': 'Гриф {0}',
|
||||
'Default for this bar type.': 'Значение по умолчанию для этого типа грифа.',
|
||||
'No bar': 'Без грифа',
|
||||
'The weight you log is all plates.': 'Записанный вес — это только блины.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Блины считаются от 0 — выключи, чтобы вернуть значение по умолчанию ({0}).',
|
||||
'Set to 0 to go back to the default ({0}).': 'Поставь 0, чтобы вернуться к значению по умолчанию ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Действует для этого упражнения везде, а не только в этом плане.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Записывается по-прежнему общий вес — гриф нужен только для расчёта блинов на сторону.',
|
||||
|
||||
@@ -327,6 +327,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'จอจะไม่ปิดขณะออกกำลังกาย จะได้ไม่ต้องปลดล็อกโทรศัพท์ระหว่างเซ็ต',
|
||||
'Weight unit': 'หน่วยน้ำหนัก',
|
||||
'Week starts on': 'สัปดาห์เริ่มวัน',
|
||||
'Weight decimals': 'ทศนิยมของน้ำหนัก',
|
||||
'How precisely weights are shown.': 'แสดงน้ำหนักละเอียดแค่ไหน',
|
||||
'0.5': '0.5',
|
||||
'0.25': '0.25',
|
||||
'Rest timer': 'ตัวจับเวลาพัก',
|
||||
'Sounds': 'เสียง',
|
||||
'Data': 'ข้อมูล',
|
||||
@@ -813,6 +817,9 @@ export default {
|
||||
'Bar ({0})': 'บาร์ ({0})',
|
||||
'Bar {0}': 'บาร์ {0}',
|
||||
'Default for this bar type.': 'ค่าเริ่มต้นสำหรับบาร์ชนิดนี้',
|
||||
'No bar': 'ไม่มีบาร์',
|
||||
'The weight you log is all plates.': 'น้ำหนักที่บันทึกคือแผ่นทั้งหมด',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'นับแผ่นจาก 0 — ปิดเพื่อกลับไปค่าเริ่มต้น ({0})',
|
||||
'Set to 0 to go back to the default ({0}).': 'ตั้งเป็น 0 เพื่อกลับไปใช้ค่าเริ่มต้น ({0})',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'มีผลกับท่านี้ทุกที่ ไม่ใช่เฉพาะในแผนนี้',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'คุณยังบันทึกน้ำหนักรวมเหมือนเดิม — บาร์ใช้สำหรับคำนวณแผ่นน้ำหนักต่อข้างเท่านั้น',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Antrenman sürerken ekran açık kalır, böylece setler arasında telefonunu açmak zorunda kalmazsın.',
|
||||
'Weight unit': 'Ağırlık birimi',
|
||||
'Week starts on': 'Hafta başlangıcı',
|
||||
'Weight decimals': 'Ağırlık ondalığı',
|
||||
'How precisely weights are shown.': 'Ağırlıklar ne kadar hassas gösterilsin.',
|
||||
'0.5': '0,5',
|
||||
'0.25': '0,25',
|
||||
'Rest timer': 'Dinlenme sayacı',
|
||||
'Sounds': 'Sesler',
|
||||
'Flash screen when timer ends': 'Zamanlayıcı bitince ekranı yanıp söndür',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': 'Bar ({0})',
|
||||
'Bar {0}': 'Bar {0}',
|
||||
'Default for this bar type.': 'Bu bar türü için varsayılan.',
|
||||
'No bar': 'Bar yok',
|
||||
'The weight you log is all plates.': 'Girdiğin ağırlığın tamamı plaka.',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': 'Plakalar 0’dan sayılır — varsayılana ({0}) dönmek için kapat.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Varsayılana ({0}) dönmek için 0 yap.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Yalnızca bu planda değil, bu egzersiz için her yerde geçerli.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Yine de toplam ağırlığı kaydedersin — bar yalnızca taraf başına plaka hesabına girer.',
|
||||
|
||||
@@ -320,6 +320,10 @@ export default {
|
||||
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': '训练进行时屏幕保持常亮,组间无需再解锁手机。',
|
||||
'Weight unit': '重量单位',
|
||||
'Week starts on': '一周开始于',
|
||||
'Weight decimals': '重量小数位',
|
||||
'How precisely weights are shown.': '重量显示的精确程度。',
|
||||
'0.5': '0.5',
|
||||
'0.25': '0.25',
|
||||
'Rest timer': '休息计时',
|
||||
'Sounds': '声音',
|
||||
'Flash screen when timer ends': '计时结束时闪烁屏幕',
|
||||
@@ -1140,6 +1144,9 @@ export default {
|
||||
'Bar ({0})': '杆 ({0})',
|
||||
'Bar {0}': '杆 {0}',
|
||||
'Default for this bar type.': '此类杠铃杆的默认值。',
|
||||
'No bar': '无杠铃杆',
|
||||
'The weight you log is all plates.': '你记录的重量全部是杠铃片。',
|
||||
'Plates are counted from 0 — turn this off for the default ({0}).': '杠铃片从 0 开始计算 — 关闭以使用默认值({0})。',
|
||||
'Set to 0 to go back to the default ({0}).': '设为 0 即恢复默认值({0})。',
|
||||
'Applies to this exercise everywhere, not just this plan.': '对这个动作处处生效,不只在此计划中。',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '记录的仍是总重量——杆重只用于每侧杠铃片的计算。',
|
||||
|
||||
+18
-3
@@ -5,7 +5,7 @@ import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipme
|
||||
import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'
|
||||
import { fmtDate, fmtNum, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
|
||||
import { lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, effectiveRoutineIds, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
|
||||
import { usesBar, barWeightFor, defaultBarWeight, hasBarOverride } from './lib/bar.js'
|
||||
import { usesBar, barWeightFor, defaultBarWeight, hasBarOverride, isNoBar } from './lib/bar.js'
|
||||
import { toScale, rirOf, EFFORT_PRESETS, effortColor } from './lib/effort.js'
|
||||
import { beep, vibrate } from './lib/sound.js'
|
||||
import { t, dateLocale, instrFor, exerciseNameFor, getLang, INSTR_LANGS } from './lib/i18n.js'
|
||||
@@ -583,17 +583,32 @@ function BarWeightEditor({ ex, extra }) {
|
||||
const st = useStore(s => s.S)
|
||||
const explicit = hasBarOverride(st, ex.id)
|
||||
const def = defaultBarWeight(ex.eq, st.unit)
|
||||
const noBar = isNoBar(st, ex.id)
|
||||
const setBar = v => update(s => {
|
||||
s.barWeights = s.barWeights || {}
|
||||
const n = Math.max(0, Math.round((v || 0) * 100) / 100)
|
||||
if (n > 0) s.barWeights[ex.id] = n; else delete s.barWeights[ex.id]
|
||||
})
|
||||
// "No bar" is a stored 0, which is a different thing from no entry at all: a counterbalanced
|
||||
// Smith carriage weighs nothing in your hands, so the plate math and the drop-set steps must
|
||||
// start from what you logged (issue #138). Clearing it goes back to the bar type's default.
|
||||
const setNoBar = on => update(s => {
|
||||
s.barWeights = s.barWeights || {}
|
||||
if (on) s.barWeights[ex.id] = 0; else delete s.barWeights[ex.id]
|
||||
})
|
||||
return <>
|
||||
<div className="row cfgrow" style={{ marginBottom: 6 }}>
|
||||
{!noBar && <div className="row cfgrow" style={{ marginBottom: 6 }}>
|
||||
<Stepper label={t('Bar ({0})', st.unit)} value={barWeightFor(st, ex) || 0} step={2.5} onChange={setBar} />
|
||||
</div>}
|
||||
<div className="list menu-list" style={{ marginBottom: 6 }}>
|
||||
<Row icon="barbell" title={t('No bar')} subtitle={t('The weight you log is all plates.')}>
|
||||
<Switch checked={noBar} onChange={setNoBar} />
|
||||
</Row>
|
||||
</div>
|
||||
<div className="small dim" style={{ marginBottom: 18 }}>
|
||||
{explicit ? t('Set to 0 to go back to the default ({0}).', fmtNum(def) + ' ' + st.unit) : t('Default for this bar type.')}
|
||||
{noBar ? t('Plates are counted from 0 — turn this off for the default ({0}).', fmtNum(def) + ' ' + st.unit)
|
||||
: explicit ? t('Set to 0 to go back to the default ({0}).', fmtNum(def) + ' ' + st.unit)
|
||||
: t('Default for this bar type.')}
|
||||
{extra ? ' ' + extra : ''}
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -204,11 +204,15 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
|
||||
// three under the sets and four more below the card is a single list you open once a session.
|
||||
const barInfo = (!cardio && !(bw && !added) && usesBar(ex)) ? (() => {
|
||||
const bar = barWeightFor(S, entry.id)
|
||||
if (!(bar > 0)) return null
|
||||
if (bar == null || bar < 0) return null
|
||||
const nextW = entry.sets.find(s => !s.done)?.w
|
||||
const refW = nextW > 0 ? nextW : Math.max(0, ...entry.sets.map(s => s.w || 0))
|
||||
const split = plateSplit(refW, bar)
|
||||
return { bar, text: t('Bar {0}', fmtNum(bar) + ' ' + S.unit) + (split != null ? ' · ' + t('{0} per side', fmtNum(split) + ' ' + S.unit) : '') }
|
||||
const perSide = split != null ? t('{0} per side', fmtNum(split) + ' ' + S.unit) : null
|
||||
// With no bar there is no bar weight worth naming — the chip is then just the plate math,
|
||||
// and it still opens the same sheet to turn it back on (issue #138).
|
||||
if (bar === 0) return perSide ? { bar, text: perSide } : null
|
||||
return { bar, text: t('Bar {0}', fmtNum(bar) + ' ' + S.unit) + (perSide ? ' · ' + perSide : '') }
|
||||
})() : null
|
||||
const openMore = () => menuSheet({
|
||||
title: exerciseNameFor(ex),
|
||||
|
||||
Reference in new issue
Block a user