Skip to content

Preserve weight chart ranges when changing entry units - #1353

Open
THEclaudi1 wants to merge 1 commit into
wger-project:masterfrom
THEclaudi1:fix-weight-chart-range-unit
Open

THEclaudi1 wants to merge 1 commit into
wger-project:masterfrom
THEclaudi1:fix-weight-chart-range-unit

Conversation

@THEclaudi1

Copy link
Copy Markdown

Proposed Changes

When a body-weight entry has stored min and max bounds, the chart reads them in the same unit as the entry. Both web editors used to update the unit tag without converting the bounds. For example, an 85–95 lb range could be shown as 85–95 kg after editing in kilograms.

  • Convert numeric bounds using the existing conversion when saving the unit, with the category unit as the fallback.
  • Preserve other metadata, missing bounds, and the grid’s unchanged-value path.

Related Issue(s)

None.

Verification

  • Added regression tests for both editors and the category fallback. The new tests failed on the original code.
  • All 1,355 frontend tests, TypeScript, scoped ESLint, and the production build passed.
  • A synthetic wger API save confirmed that metadata and the converted range are retained and that the chart bucket reads the correct bounds.

AI assistance was used to prepare and verify this change.

Proposed Changes

Related Issue(s)

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 89.42% (+0.02%) from 89.405% — THEclaudi1:fix-weight-chart-range-unit into wger-project:master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants