Repository navigation
Show training log chart weights in the user's unit - #1328
Merged
rolandgeider merged 2 commits intoOct 24, 2026
Merged
Conversation
The exercise log chart always labelled its axis "kg" and plotted the raw logged weight, so lb logs (or kg logs for imperial users) were shown with the wrong unit. Use the display weight unit and convert kg/lb logs. Refs wger-project/wger#2149
Use t('server.kg')/t('server.lb') for the Y axis unit label per
review feedback, instead of the raw unit string.
Collaborator
Member
|
merged 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
TimeSeriesChartinLogWidgets.tsx) had its Y axis hard-coded tokgand plotted the raw logged weight, whatever unit the log was in. It now usesuseDisplayWeightUnit()(the same hook other screens use, based on the profile's metric setting) for the axis and tooltip unit.formatDataconverts logs recorded in kg or lb into that unit with the existingconvertWeighthelper. Logs in other units (plates, body weight, etc.) and logs without a weight are passed through unchanged.formatDataunit tests (lb→kg and kg→lb conversion; other units andnullpassed through).LogWidgets.test.tsxandWorkoutLogs.test.tsxnow mock the profile query, because the chart reads it.Related Issue(s)
Refs wger-project/wger#2149 (this covers the web chart. The issue also mentions the mobile app, so I didn't use "Closes").
Please check that the PR fulfills these requirements
I used AI assistance to write this change. Tested:
npx vitest run(180 files, 1176 tests pass),eslinton the touched files, andtsc --noEmit. The newformatDatatests fail without the change. I have not checked it by hand against a running wger server.