Repository navigation
fix(plates): keep fractional targets on attainable loads - #433
Merged
DuarteSantos8 merged 1 commit intoOct 9, 2026
Merged
Conversation
crstnmac
added a commit
to crstnmac/openGym
that referenced
this pull request
Oct 9, 2026
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.
A target between quarter-unit boundaries is rounded before plate selection, so requesting 2.4 kg can recommend a 2.5 kg plate and claim nothing is missing. The same rounded deficit feeds
dropGrid: a 48.74 kg barbell target with 5 kg pairs produces 40.24 kg, which those plates cannot load.Floor the search target to the quarter-unit grid and calculate the deficit against the original requested weight. Exact grid-aligned targets retain their existing behavior; fractional targets return the closest attainable load below them.
Validation: six new regression cases fail on main and pass with the fix. All 103 tests in plates, workout-model, Workout.plates, and sheets.plates pass. Chromium smoke-tested starting a demo workout and verified the real browser module returns an empty stack with 2.4 kg missing, and a 40 kg drop-set load for the examples above. No page errors occurred.
Searched issues/PRs for plates, plateStack, rounding, and dropGrid. #354 concerns persistence of a load-kind selection, not this arithmetic. AI-assisted contribution.