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.

Merge remote-tracking branch 'pr/432'

Duarte Santos68f8120bd871
diff --cc frontend/src/lib/import-csv.js
index c4e739786,a7ff3c272..553cc0937
--- a/frontend/src/lib/import-csv.js
+++ b/frontend/src/lib/import-csv.js
@@@ -688,12 -615,7 +688,13 @@@ export function parseBodyweight(text,
if (!val || !dt) continue
const when = parseWhen(dt[1])
if (!when) continue
- if (u) fileUnit = /lb/i.test(u[1]) ? 'lb' : 'kg'
- out.set(when.d, { w: parseFloat(val[1]), unit: u && /lb/i.test(u[1]) ? 'lb' : 'kg', t: new Date(dt[1]).getTime() || null })
++ // Each record keeps its own unit: Health labels every one, and a file can mix kg and lb (#432).
++ const recUnit = u ? (/lb/i.test(u[1]) ? 'lb' : 'kg') : ''
+ // `[\d.]+` lets a bare "." through, which parseFloat reads as NaN, and a zeroed record is
+ // no weigh-in either — the same gate the CSV branch below applies with `!w`.
+ const w = parseFloat(val[1])
- if (!isFinite(w) || !w || !bodyOk(w, fileUnit || unit)) continue
- out.set(when.d, { w, t: new Date(dt[1]).getTime() || null })
++ if (!isFinite(w) || !w || !bodyOk(w, recUnit || unit)) continue
++ out.set(when.d, { w, unit: recUnit, t: new Date(dt[1]).getTime() || null })
}
} else {
const rows = parseCSV(s)