Skip to content

fix(plates): keep fractional targets on attainable loads - #433

Merged
DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
ac1982:fix/plate-stack-fractional-target
Oct 9, 2026
Merged

DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
ac1982:fix/plate-stack-fractional-target

Conversation

@ac1982

@ac1982 ac1982 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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.

crstnmac added a commit to crstnmac/openGym that referenced this pull request Oct 9, 2026
@DuarteSantos8
DuarteSantos8 merged commit 0fc9f68 into DuarteSantos8:main Oct 9, 2026
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