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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
feat(stats): "Lifted in total", a tile with everything you've ever lifted (Discord)
Duarte Santos412fd17a6dc6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d7ce9ff3b..242f3f204 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -76,6 +76,8 @@ per muscle. Settings → Workout → Fine-tuning turns it off.- **Count warm-ups in volume**, if you like (#719). A new switch in Settings → Units & languageadds your done warm-ups to every volume the app shows: the workout, the summary, history,Stats, the report and the coach. Off by default, and records ignore warm-ups either way.+- **Lifted in total.** Stats has a new tile with everything you've ever lifted, imports included.+ Spoiler: it's a lot.**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 thatdiff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.jsindex 0f62de7d5..ed672b75b 100644--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@ -774,6 +774,8 @@ export function sessionVolume(w, S) {const v = Number(w?.vol)return Number.isFinite(v) ? Math.max(0, v) : 0}+// Everything ever lifted, the Stats tile (Discord): each session counted the way it shows.+export const lifetimeVolume = S => (Array.isArray(S?.workouts) ? S.workouts : []).reduce((n, w) => n + sessionVolume(w, S), 0)// Finished sessions carry their canonical local calendar day in `d`. Keep it aligned with// History/calendar readers, and use the local start timestamp only for older records whose date// is missing or malformed. Invalid records stay out of the activity map.diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex c51d9731c..5ba0c32d1 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('5854fc8bd0fa65b51bf0a54694cdd181e6993bc11c0bced2fb520e7fdbb1f75e')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('50a3caa2f525165b7ee0326260394f22b578b0bbdc0a2bf202c89769a1f07bb0')})// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button thatdiff --git a/frontend/src/lib/volume-warmups.test.js b/frontend/src/lib/volume-warmups.test.jsindex 9e37e1ab5..0c8951257 100644--- a/frontend/src/lib/volume-warmups.test.js+++ b/frontend/src/lib/volume-warmups.test.js@@ -2,7 +2,7 @@// that says "volume" counts the done warm-ups too. The saved `vol` never changes, so the switch// can go back and forth without touching history. Records and progression never read warm-ups.import { describe, expect, it } from 'vitest'-import { workoutVolume, sessionVolume, countsWarmups } from './history.js'+import { workoutVolume, sessionVolume, lifetimeVolume, countsWarmups } from './history.js'import { totalsOf, reportData } from './report.js'import { exerciseHistory } from './exercise-history.js'import { insightsFor, sessionInsights } from './coach-insights.js'@@ -45,6 +45,13 @@ describe('workoutVolume and the warm-up switch', () => {expect(workoutVolume(w, { warmups: true })).toBe(110)expect(workoutVolume(w)).toBe(0)})++ it('adds up a lifetime the same way', () => {+ expect(lifetimeVolume(profile(false))).toBe(1200)+ expect(lifetimeVolume(profile(true))).toBe(2000)+ expect(lifetimeVolume(profile(false, [session('2026-10-01'), { d: '2020-01-01', vol: 5000 }]))).toBe(5600)+ expect(lifetimeVolume({})).toBe(0)+ })})describe('every reader follows it', () => {diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex db0612acc..f32927946 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -161,6 +161,7 @@ export default {'Volume': 'حجم التدريب','Count warm-ups in volume': 'احتساب الإحماء في حجم التدريب','Handy when you compare with another app. Records ignore warm-ups either way.': 'مفيد عند المقارنة مع تطبيق آخر. الأرقام القياسية تتجاهل الإحماء في كل الأحوال.',+ 'Lifted in total': 'المرفوع إجمالًا','PRs': 'الأرقام القياسية','New PR:': 'رقم قياسي جديد:','Nice!': 'رائع!',diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex 5aa2fa736..327c86d10 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -188,6 +188,7 @@ export default {'Volume': 'ভলিউম','Count warm-ups in volume': 'ভলিউমে ওয়ার্ম-আপ গুনুন','Handy when you compare with another app. Records ignore warm-ups either way.': 'অন্য অ্যাপের সাথে তুলনা করতে কাজে লাগে। রেকর্ড সব সময়ই ওয়ার্ম-আপ বাদ দেয়।',+ 'Lifted in total': 'মোট তোলা','PRs': 'রেকর্ড','New PR:': 'নতুন রেকর্ড:','Nice!': 'দারুণ!',diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 568e1ad7b..665dd7004 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -164,6 +164,7 @@ export default {'Volume': 'Volumen','Count warm-ups in volume': 'Aufwärmsätze ins Volumen zählen','Handy when you compare with another app. Records ignore warm-ups either way.': 'Praktisch, wenn du mit einer anderen App vergleichst. Rekorde ignorieren Aufwärmsätze so oder so.',+ 'Lifted in total': 'Insgesamt bewegt','PRs': 'Rekorde','New PR:': 'Neuer Rekord:','Nice!': 'Stark!',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 836a99d72..978e357a3 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -157,6 +157,7 @@ export default {'Volume': 'Volumen','Count warm-ups in volume': 'Contar el calentamiento en el volumen','Handy when you compare with another app. Records ignore warm-ups either way.': 'Útil si comparas con otra app. Los récords ignoran el calentamiento de todos modos.',+ 'Lifted in total': 'Levantado en total','PRs': 'Récords','New PR:': 'Nuevo récord:','Nice!': '¡Genial!',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 502742fbc..40c5f7be4 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -157,6 +157,7 @@ export default {'Volume': 'Volume','Count warm-ups in volume': 'Compter les échauffements dans le volume','Handy when you compare with another app. Records ignore warm-ups either way.': 'Pratique pour comparer avec une autre appli. Les records ignorent les échauffements dans tous les cas.',+ 'Lifted in total': 'Soulevé au total','PRs': 'Records','New PR:': 'Nouveau record :','Nice!': 'Bien joué !',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 45ba5f90a..7749a8aa3 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -157,6 +157,7 @@ export default {'Volume': 'वॉल्यूम','Count warm-ups in volume': 'वॉल्यूम में वार्म-अप गिनें','Handy when you compare with another app. Records ignore warm-ups either way.': 'किसी दूसरे ऐप से तुलना करते समय काम आता है। रिकॉर्ड वार्म-अप को हर हाल में नज़रअंदाज़ करते हैं।',+ 'Lifted in total': 'कुल उठाया गया','PRs': 'रिकॉर्ड','New PR:': 'नया रिकॉर्ड:','Nice!': 'बहुत बढ़िया!',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex f36a0cdd3..e9c2b4567 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -155,6 +155,7 @@ export default {'Volume': 'Volumen','Count warm-ups in volume': 'Bemelegítés beszámítása a volumenbe','Handy when you compare with another app. Records ignore warm-ups either way.': 'Jól jön, ha egy másik appal hasonlítasz össze. A rekordok így is, úgy is figyelmen kívül hagyják a bemelegítést.',+ 'Lifted in total': 'Összesen megmozgatva','PRs': 'Rekordok','New PR:': 'Új rekord:','Nice!': 'Szuper!',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex d9a250246..afd10c9c4 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -157,6 +157,7 @@ export default {'Volume': 'Volume','Count warm-ups in volume': 'Conta il riscaldamento nel volume','Handy when you compare with another app. Records ignore warm-ups either way.': "Utile se fai il confronto con un'altra app. I record ignorano comunque il riscaldamento.",+ 'Lifted in total': 'Sollevato in totale','PRs': 'Record','New PR:': 'Nuovo record:','Nice!': 'Grande!',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 5e12cdd76..073b5bdf6 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -157,6 +157,7 @@ export default {'Volume': '볼륨','Count warm-ups in volume': '워밍업을 볼륨에 포함','Handy when you compare with another app. Records ignore warm-ups either way.': '다른 앱과 비교할 때 유용해요. 기록에는 어느 쪽이든 워밍업이 반영되지 않아요.',+ 'Lifted in total': '지금까지 든 총량','PRs': '신기록','New PR:': '신기록:','Nice!': '좋아요!',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 6ee3eacb1..fa53b66c2 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -157,6 +157,7 @@ export default {'Volume': 'Objętość','Count warm-ups in volume': 'Wliczaj rozgrzewkę do objętości','Handy when you compare with another app. Records ignore warm-ups either way.': 'Przydaje się przy porównaniu z inną aplikacją. Rekordy i tak pomijają rozgrzewkę.',+ 'Lifted in total': 'Podniesione łącznie','PRs': 'Rekordy','New PR:': 'Nowy rekord:','Nice!': 'Świetnie!',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex d1ec393b1..267cd4118 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -157,6 +157,7 @@ export default {'Volume': 'Volume','Count warm-ups in volume': 'Contar aquecimentos no volume','Handy when you compare with another app. Records ignore warm-ups either way.': 'Dá jeito quando comparas com outra app. Os recordes ignoram os aquecimentos de qualquer forma.',+ 'Lifted in total': 'Levantado no total','PRs': 'Recordes','New PR:': 'Novo recorde:','Nice!': 'Boa!',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex b9483bd6e..decf561b6 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -153,6 +153,7 @@ export default {'Volume': 'Объём','Count warm-ups in volume': 'Учитывать разминку в объёме','Handy when you compare with another app. Records ignore warm-ups either way.': 'Удобно, если сравниваешь с другим приложением. Рекорды в любом случае не учитывают разминку.',+ 'Lifted in total': 'Поднято всего','PRs': 'Рекорды','New PR:': 'Новый рекорд:','Nice!': 'Отлично!',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex cd4e32369..c7c6838d8 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -155,6 +155,7 @@ export default {'Volume': 'ปริมาณงาน','Count warm-ups in volume': 'นับเซ็ตวอร์มอัพในปริมาณงาน','Handy when you compare with another app. Records ignore warm-ups either way.': 'สะดวกเวลาเทียบกับแอปอื่น สถิติสูงสุดไม่นับวอร์มอัพอยู่แล้วไม่ว่าแบบไหน',+ 'Lifted in total': 'ยกไปทั้งหมด','PRs': 'สถิติใหม่','New PR:': 'สถิติใหม่:','Nice!': 'เยี่ยม!',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex ba2ddf54d..1e2009e0d 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -157,6 +157,7 @@ export default {'Volume': 'Hacim','Count warm-ups in volume': 'Isınma setlerini hacme kat','Handy when you compare with another app. Records ignore warm-ups either way.': 'Başka bir uygulamayla karşılaştırırken işe yarar. Rekorlar ısınmayı her durumda saymaz.',+ 'Lifted in total': 'Toplam kaldırılan','PRs': 'Rekorlar','New PR:': 'Yeni rekor:','Nice!': 'Süper!',diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex d7a839e9f..10194aed6 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -139,6 +139,7 @@ export default {'Volume': 'Обсяг','Count warm-ups in volume': 'Враховувати розминку в обсязі','Handy when you compare with another app. Records ignore warm-ups either way.': 'Зручно, коли порівнюєш з іншим застосунком. Рекорди в будь-якому разі не враховують розминку.',+ 'Lifted in total': 'Піднято загалом','PRs': 'Рекорди','New PR:': 'Новий рекорд:','Nice!': 'Чудово!',diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex 9e946bd81..0f99da689 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -153,6 +153,7 @@ export default {'Volume': '總訓練量','Count warm-ups in volume': '熱身組計入總訓練量','Handy when you compare with another app. Records ignore warm-ups either way.': '和其他 App 比較時很方便。紀錄無論如何都不算熱身組。',+ 'Lifted in total': '累計舉起','PRs': '個人紀錄','New PR:': '突破個人紀錄:','Nice!': '太棒了!',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex eed731fa9..0ba8d3a2b 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -157,6 +157,7 @@ export default {'Volume': '总量','Count warm-ups in volume': '热身组计入总量','Handy when you compare with another app. Records ignore warm-ups either way.': '和其他应用对比时很方便。纪录无论如何都不算热身组。',+ 'Lifted in total': '累计举起','PRs': '纪录','New PR:': '新纪录:','Nice!': '太棒了!',diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsxindex 7c7d29ec1..da080ecf4 100644--- a/frontend/src/views/Stats.jsx+++ b/frontend/src/views/Stats.jsx@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'import { dayPhotosOf } from '../lib/day-photos.js'import { EXIDX, matchExercise, betterWeight, isAssisted } from '../lib/exercises.js'-import { lastBW, streakWeeks, setLabel, modeOf, effortOf, entriesForExercise, metricEntriesForExercise, metricModeForEntry, bestWeightForEntry, completedRepsOf, workoutDay, workoutAt } from '../lib/history.js'+import { lastBW, streakWeeks, setLabel, modeOf, effortOf, entriesForExercise, metricEntriesForExercise, metricModeForEntry, bestWeightForEntry, completedRepsOf, workoutDay, workoutAt, lifetimeVolume } from '../lib/history.js'import { fmtNum, fmtDate, fmtVol, todayISO, isoOf, weekKey, weekStartOf, exerciseNameText } from '../lib/format.js'import { speedUnitOf, speedLabel, toSpeed } from '../lib/speed.js'import { t, exerciseNameFor, exerciseNameClass, getLang } from '../lib/i18n.js'@@ -497,6 +497,7 @@ export default function Stats() {const bwDelta30 = bw30.length > 1 ? bw30[bw30.length - 1].w - bw30[0].w : nullconst workouts = S.workoutsconst monthW = workouts.filter(w => workoutDay(w)?.slice(0, 7) === todayISO().slice(0, 7)).length+ const lifetime = lifetimeVolume(S)// Dumbbell weights are read in each exercise's current meaning (lib/dumbbells.js), so the// chart and its best compare like with like across a switch between per bell and total.@@ -708,7 +709,9 @@ export default function Stats() {<div className="tile"><div className="l"><Icon name="calendar" />{t('This month')}</div><div className="v">{monthW}</div></div><div className="tile"><div className="l"><Icon name="flame" />{t('Week streak')}</div><div className="v">{streakWeeks(S)}</div></div><div className="tile"><div className="l"><Icon name="scale" />{t('Weight 30d')}</div><div className="v" style={{ fontSize: 22, color: bwDelta30 === null ? 'inherit' : bwDeltaColor(bwDelta30, (lastBW(S) || {}).w || 0) }}>{bwDelta30 === null ? '–' : (bwDelta30 > 0 ? '+' : '') + fmtNum(bwDelta30) + ' ' + S.unit}</div></div>-+ {/* Everything ever lifted (Discord): imports included, warm-ups only when the profile+ counts them (#719). Full width, since a few hundred sessions make a long number. */}+ {lifetime > 0 && <div className="tile" style={{ gridColumn: '1 / -1' }} data-lifetime-volume><div className="l"><Icon name="plate" />{t('Lifted in total')}</div><div className="v">{fmtVol(Math.round(lifetime), S.unit)}</div></div>}</div><div className="card">diff --git a/frontend/src/views/Stats.lifetime-volume.test.jsx b/frontend/src/views/Stats.lifetime-volume.test.jsxnew file mode 100644index 000000000..7d7629557--- /dev/null+++ b/frontend/src/views/Stats.lifetime-volume.test.jsx@@ -0,0 +1,64 @@+// @vitest-environment happy-dom+// Everything ever lifted, a tile on Stats (Discord): imported sessions count, warm-ups only when+// the profile counts them (#719), and a profile with nothing lifted gets no tile at all.+import React, { act } from 'react'+import { createRoot } from 'react-dom/client'+import { afterEach, describe, expect, it, vi } from 'vitest'+import Stats from './Stats.jsx'++const mocks = vi.hoisted(() => ({ S: null }))+vi.mock('../store/useStore.js', () => ({ useStore: selector => selector({ S: mocks.S }) }))+vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))+vi.mock('../sheets.jsx', () => ({+ bwSheet: () => {}, goalSheet: () => {}, calendarSheet: () => {}, workoutDetailSheet: () => {}, exerciseHistorySheet: () => {},+ WorkoutRow: () => null, bwDeltaColor: () => 'inherit',+}))+vi.mock('../components/LineChart.jsx', () => ({ default: () => null }))+vi.mock('../components/Heatmap.jsx', () => ({ default: () => null }))+vi.mock('../components/BodyMap.jsx', () => ({ default: () => null, BodyMapLegend: () => null }))++globalThis.IS_REACT_ACT_ENVIRONMENT = true+const BENCH = '0025'+const session = (d, sets) => ({+ id: d, d, name: 'Push', start: Date.parse(d + 'T10:00:00Z'), end: Date.parse(d + 'T11:00:00Z'),+ entries: [{ id: BENCH, target: { sets: sets.length, reps: 5 }, sets }],+})+const warm = (w, r) => ({ w, r, done: true, phase: 'warmup', warmup: true })+const work = (w, r) => ({ w, r, done: true })++let root, host+afterEach(() => { act(() => root.unmount()); host.remove() })++function mount(settings, workouts) {+ mocks.S = { unit: 'kg', body: 'male', effort: 'none', targetW: null, bodyweight: [], routines: [], exWeights: {}, ...settings, workouts }+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+ act(() => root.render(<Stats />))+ return host.querySelector('[data-lifetime-volume] .v')?.textContent ?? null+}++const history = () => [+ session('2026-09-01', [warm(40, 10), work(100, 5), work(100, 5)]),+ session('2026-09-08', [work(102.5, 5)]),+ // An imported year-old session counts like any other.+ { ...session('2025-01-05', Array.from({ length: 10 }, () => work(100, 10))), name: 'Imported', vol: 10000 },+]++describe('Stats: lifted in total', () => {+ it('adds up every session in the profile unit', () => {+ expect(mount({}, history())).toBe('11,513 kg')+ })++ it('takes the warm-ups in when the profile counts them', () => {+ expect(mount({ volumeWarmups: true }, history())).toBe('11,913 kg')+ })++ it('says lb for a pound profile', () => {+ expect(mount({ unit: 'lb' }, [session('2026-09-01', [work(225, 5)])])).toBe('1,125 lb')+ })++ it('stays away until something was lifted', () => {+ expect(mount({}, [])).toBeNull()+ })+})