astashov / liftosaur

Weightlifting tracker app for coders
https://www.liftosaur.com
GNU Affero General Public License v3.0
241 stars 32 forks source link

Adapt plate calculations to find the nearest set of plates. #94

Open RlndVt opened 5 months ago

RlndVt commented 5 months ago

As discussed on Discord:

Currently weight and plate calculation searches for a set of plates that doesn't exceed the target weight. Effectively a 'floor' of the target weight to the smallest plate weight.

It is better however to get 'as close as possible' to the target weight using the available plates. (Equivalent to 'rounding'.)

The floor vs rounding issue is most prominent when using percentage based workouts or warmup.

e.g. say your workout weight is 52.5kg, and you want to warmup at 90% (10% difference). Further say our smallest plate is 1.25kg, resulting in steps of 2.5kg. As currently implemented the resulting warmup will be at 45kg, effectively a 14,3% delta; with the proposed change the warmup will be at 47.5kg, effectively 9,5%.

RlndVt commented 5 months ago

I'm having another look at the changes to calculatePlatesInternalFast.