astashov / liftosaur

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

Fix History.getmaxset #23

Closed sachaventura2 closed 2 years ago

sachaventura2 commented 2 years ago

Hi there :) Thanks heaps for this app! I've started to use it and I am keen to help improve it even further. My javascript is rusty so I would appreciate your review.

I noticed that when making personal records, the number of reps displayed did not match the true highest reps performed with that weight (e.g. with an AMRAP set).

Example:

Screenshot 2022-01-21 at 3 46 43 pm

I was expecting the PR to be "10x45 lb" but instead:

Screenshot 2022-01-21 at 4 14 13 pm

I've tracked down the logic to History.getMaxSet and added logic to compare 2 sets using the completedReps when the weights are the same. I've also added a small unit test covering this use case. Results:

Screenshot 2022-01-21 at 3 46 49 pm