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 upstream validation into per-record Apple Health conversion

AC6886a917995c
diff --cc frontend/src/lib/import-csv.js
index a7ff3c272,c4e739786..ade064f2f
--- a/frontend/src/lib/import-csv.js
+++ b/frontend/src/lib/import-csv.js
@@@ -615,7 -688,12 +688,11 @@@ export function parseBodyweight(text,
if (!val || !dt) continue
const when = parseWhen(dt[1])
if (!when) continue
- out.set(when.d, { w: parseFloat(val[1]), unit: u && /lb/i.test(u[1]) ? 'lb' : 'kg', t: new Date(dt[1]).getTime() || null })
- if (u) fileUnit = /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 recordUnit = u && /lb/i.test(u[1]) ? 'lb' : 'kg'
++ // Keep the upstream validity gate, using this record's unit for the limit.
+ 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, recordUnit)) continue
++ out.set(when.d, { w, unit: recordUnit, t: new Date(dt[1]).getTime() || null })
}
} else {
const rows = parseCSV(s)