Skip to content

Conversation

@zeegomo
Copy link
Contributor

@zeegomo zeegomo commented Jan 3, 2022

No description provided.

@zeegomo zeegomo marked this pull request as ready for review January 14, 2022 10:28
@zeegomo zeegomo requested a review from a team January 14, 2022 15:48
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;
Copy link
Contributor

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

.into_iter()
.map(|(review, rankings)| (review, calc_final_ranking_per_review(&rankings)))
.collect::<BTreeMap<_, _>>();
dbg!(&final_rankings_per_review);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dbg!(&final_rankings_per_review);

})
.counts_by(|ranking| ranking.vca.clone());

dbg!(&rankings_per_vca);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dbg!(&rankings_per_vca);

.counts_by(|ranking| ranking.vca.clone());

dbg!(&rankings_per_vca);
dbg!(&eligible_rankings_per_vca);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dbg!(&eligible_rankings_per_vca);

Copy link
Contributor

@Mr-Leshiy Mr-Leshiy left a 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);
Copy link
Contributor

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>;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: EligibilityRange? :)

Copy link
Contributor Author

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

}

fn calc_final_ranking_per_review(rankings: &[impl Borrow<VeteranRankingRow>]) -> ReviewRanking {
let rankings_majority = rankings.len() / 2;
Copy link
Contributor

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?

@zeegomo
Copy link
Contributor Author

zeegomo commented Jan 17, 2022

I had to refactor VeteranRankingRow as #[serde(flatten)] was not behaving as expect

Copy link
Contributor

@eugene-babichenko eugene-babichenko left a 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.

@zeegomo zeegomo merged commit 75bce99 into main Feb 28, 2022
@zeegomo zeegomo deleted the vca-reward branch February 28, 2022 16:22
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.

4 participants