-
Notifications
You must be signed in to change notification settings - Fork 14
Vca reward #84
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
Vca reward #84
Conversation
src/rewards/mod.rs
Outdated
| use rust_decimal::Decimal; | ||
| pub type Funds = Decimal; | ||
| // Lets match to the same type as the funds, but naming it funds would be confusing | ||
| pub type Rewards = Funds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better in this case to alias to the Decimal type explicitly
src/rewards/veterans.rs
Outdated
| .into_iter() | ||
| .map(|(review, rankings)| (review, calc_final_ranking_per_review(&rankings))) | ||
| .collect::<BTreeMap<_, _>>(); | ||
| dbg!(&final_rankings_per_review); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dbg!(&final_rankings_per_review); |
src/rewards/veterans.rs
Outdated
| }) | ||
| .counts_by(|ranking| ranking.vca.clone()); | ||
|
|
||
| dbg!(&rankings_per_vca); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dbg!(&rankings_per_vca); |
src/rewards/veterans.rs
Outdated
| .counts_by(|ranking| ranking.vca.clone()); | ||
|
|
||
| dbg!(&rankings_per_vca); | ||
| dbg!(&eligible_rankings_per_vca); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dbg!(&eligible_rankings_per_vca); |
Mr-Leshiy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| use crate::utils::serde::deserialize_truthy_falsy; | ||
| use serde::Deserialize; | ||
|
|
||
| pub type AdvisorReviewId = (String, String); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe document this alias? It's not really obvious what these 2 strings are.
| pub reputation: u64, | ||
| } | ||
|
|
||
| pub type EligibilityThresholds = std::ops::RangeInclusive<usize>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: EligibilityRange? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it's a bit counterintuitive the way it's written, but it was to keep naming close to the requirements
src/rewards/veterans.rs
Outdated
| } | ||
|
|
||
| fn calc_final_ranking_per_review(rankings: &[impl Borrow<VeteranRankingRow>]) -> ReviewRanking { | ||
| let rankings_majority = rankings.len() / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the type of rankings_majority? Is it going to lead to any possible mistakes? I'm always a bit wary of divisions. Maybe employ decimals here as well?
|
I had to refactor |
eugene-babichenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in general is LGTM, let's see how it survives real-life testing.
No description provided.