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
Import: hyphenated names get the same body part as their spaced spelling (QA C28)
Duarte Santosf9715d76d35d
diff --git a/frontend/src/lib/import-csv.js b/frontend/src/lib/import-csv.jsindex f15e6df8d..104ad9b77 100644--- a/frontend/src/lib/import-csv.js+++ b/frontend/src/lib/import-csv.js@@ -286,7 +286,13 @@ const NAME_BP = [[/\bneck\b/, 'neck'],[/\bgrip\b/, 'lower arms'],]-export const bpFromName = name => (NAME_BP.find(([re]) => re.test(name)) || [])[1] || null+// Hyphens, underscores and slashes read as spaces first: "Stiff-Legged Deadlift" and+// "Chest-Supported Row" are the same names the rules above spell with a space, and the+// matcher (wordsOf) already treats the two spellings as one exercise — the body part has to agree.+export const bpFromName = name => {+ const n = String(name || '').toLowerCase().replace(/[-_/]+/g, ' ').replace(/\s+/g, ' ').trim()+ return (NAME_BP.find(([re]) => re.test(n)) || [])[1] || null+}// Categories the exporters use -> the dataset's body parts, for exercises we invent.const CATEGORY_BP = {diff --git a/frontend/src/lib/import-name-bodypart.test.js b/frontend/src/lib/import-name-bodypart.test.jsindex 976731b8c..0191f7c96 100644--- a/frontend/src/lib/import-name-bodypart.test.js+++ b/frontend/src/lib/import-name-bodypart.test.js@@ -27,6 +27,19 @@ describe('body part from an exercise name', () => {expect(bp('Deadlift')).toBe('back')})+ // The rules are written with spaces, but people hyphenate these names as often as not (QA C28).+ // The matcher already treats "chest-supported row" and "chest supported row" as one exercise;+ // the body-part fallback has to agree with it, or the two spellings land on different maps.+ it('reads the hyphenated, underscored and slashed spellings like the spaced ones', () => {+ expect(bp('Stiff-Legged Deadlift')).toBe('upper legs')+ expect(bp('Straight-Leg Deadlift')).toBe('upper legs')+ expect(bp('Stiff_Leg Deadlift')).toBe('upper legs')+ expect(bp('Chest-Supported Row')).toBe('back')+ expect(bp('Chest-Supported T-Bar Row')).toBe('back')+ expect(bp('Chest/Supported Row')).toBe('back')+ expect(bp('Sit-Up')).toBe('waist')+ })+it('still reads a bare grip exercise as forearms, and the rest as before', () => {expect(bp('Grip Trainer')).toBe('lower arms')expect(bp('Back Squat')).toBe('back') // unchanged: "back" is matched before "squat"