fix: fix bodyweight import source, docker compose build path, PR calculation, and add .gitignore - #33
Conversation
…ulation, and add .gitignore
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, targeted, and include unit tests for the updated bodyweight import behavior while reducing the risk of NaN affecting PR detection.
Pull request overview
This PR tightens up import attribution for bodyweight files, fixes a Docker Compose build path, and hardens PR detection logic so undefined set weights don’t suppress new personal records. It also adds repo hygiene via a standard .gitignore, plus unit tests covering the updated bodyweight source detection.
Changes:
- Fix PR (personal record) max-weight calculation to avoid
NaNwhen some completed sets have no weight. - Update
parseBodyweightto label imports asApple Health(XML) vsCSV(tabular) and add tests for both cases. - Correct the
docker-compose.ymlwebservice to build from the repo-rootDockerfileand add a standard.gitignore.
File summaries
| File | Description |
|---|---|
frontend/src/sheets.jsx |
Prevents Math.max from producing NaN when completed sets have undefined weights, ensuring PR detection works for bodyweight/cardio-style sets. |
frontend/src/lib/import-effort.test.js |
Adds unit tests confirming bodyweight import source detection for CSV vs Apple Health XML. |
frontend/src/lib/import-csv.js |
Implements dynamic detection of Apple Health XML vs CSV for bodyweight imports and sets source accordingly. |
docker-compose.yml |
Fixes the Dockerfile path for the web service build configuration. |
.gitignore |
Adds common ignores for dependencies, build output, env files, and local/runtime data directories. |
Review details
- Files reviewed: 4/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Heads up: openGym has moved to GitLab. The GitHub repo is no longer maintained (the account was suspended, so it's out of my hands). Please re-open this issue/PR on GitLab so it doesn't get lost, I'll pick it up there. Questions, help and roadmap discussion now happen in Discord: Sorry for the noise, and thanks for sticking around. |
Summary
parseBodyweightnow dynamically detects whether the input was an Apple Health XML export or a CSV file, returning'CSV'instead of hardcoded'Apple Health'for CSV imports.dockerfile: web/Dockerfiletodockerfile: Dockerfileindocker-compose.yml(webservice).s.w || 0indoFinishWorkout(sheets.jsx:942) to preventundefinedset weights (such as bodyweight/cardio sets) from generatingNaNinMath.maxand causing new personal records to be skipped..gitignorecoveringnode_modules/,data/,media/img/,media/gif/,dist/,.env, and OS/editor files.import-effort.test.jsverifying bodyweight source detection for both CSV and XML.Test plan
npm test— all 194 unit tests passing (including 2 new tests)node frontend/scripts/check-locales.mjs— 11 locales, 628 keys each in syncnpm run build— Vite build succeeds cleanly