Skip to content

fix: use unit IDs directly in Log.fromSetConfigData to prevent null on save - #1175

Merged
rolandgeider merged 1 commit into
wger-project:masterfrom
efrahim20319:fix/1149-log-missing-unit-defaults
Apr 13, 2026
Merged

fix: use unit IDs directly in Log.fromSetConfigData to prevent null on save#1175
rolandgeider merged 1 commit into
wger-project:masterfrom
efrahim20319:fix/1149-log-missing-unit-defaults

Conversation

@efrahim20319

@efrahim20319 efrahim20319 commented Apr 13, 2026

Copy link
Copy Markdown

When adding an extra exercise during a workout, addExerciseAfterPage() creates a SetConfigData with no unit objects loaded. Log.fromSetConfigData was using the weightUnit/repetitionUnit setters which overwrite the default IDs with null when the objects are null, causing the server to reject the request with a ValidationError ("Repetitions unit must be present").

Fixes #1149

Proposed Changes

Related Issue(s)

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100-character limit to avoid white space diffs (run dart format .)

…n save

When adding an extra exercise during a workout, addExerciseAfterPage()
creates a SetConfigData with no unit objects loaded. Log.fromSetConfigData
was using the weightUnit/repetitionUnit setters which overwrite the default
IDs with null when the objects are null, causing the server to reject the
request with a ValidationError ("Repetitions unit must be present").

Fixes wger-project#1149

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rolandgeider

Copy link
Copy Markdown
Member

looks good, thanks!

Those weightUnit and repetitionUnit setters are a bit of a pain / fragile, we should probably refactor how those work when we merge wger-project/wger#2275

@rolandgeider
rolandgeider merged commit 10a28ac into wger-project:master Apr 13, 2026
1 check passed
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.

Cannot save exercise when added outside of the routine

3 participants