Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔪 reps-per-round #83

Merged
merged 1 commit into from
Nov 9, 2023
Merged

🔪 reps-per-round #83

merged 1 commit into from
Nov 9, 2023

Conversation

theianjones
Copy link
Owner

knife

Comment on lines +23 to +24
[{:keys [rounds] :as params}]
(+ (/ (float (reps->score params)) REPS_MULTIPLIER) (n/parse-int rounds)))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of referencing the reps per round to normalize score, we divide by 1000 and add that remainder to the rounds integer.

Comment on lines +60 to +65
(is (= [{:reps "116" :index 0 :notes "" :id nil}
{:reps "102" :index 1 :notes "fell off my pace" :id nil}
{:reps "96" :index 2 :notes "couldnt think anymore" :id nil}]
(sut/->scores params-with-reps))))
(testing "defaults rounds to score to 1"
(is (= [{:reps "116" :index 0 :notes ""}]
(is (= [{:reps "116" :index 0 :notes "" :id nil}]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think our tests run in ci... these were failing lol

Comment on lines +10 to +19
[reps-per-round score]
(if (int? score)
(if (> 0 score)
"0+0"
(str (quot score reps-per-round)
"+"
(rem score reps-per-round)))
(let [rounds (.intValue score)
reps (.intValue (* REPS_MULTIPLIER (- (bigdec score) rounds)))]
(str rounds "+" reps))))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will handle old results that require reps-per-round and new results that we record.

We can merge this and things shouldnt break, migrate the old data to be a float, then delete the if block here

@theianjones theianjones merged commit 02ba68e into main Nov 9, 2023
3 checks passed
@theianjones theianjones deleted the ij/refactor-rounds-reps branch November 9, 2023 04:29
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.

None yet

1 participant