Skip to content

Commit

Permalink
also take in account good assessments when computing consensus on exc…
Browse files Browse the repository at this point in the history
…ellent ratings
  • Loading branch information
2072 committed Aug 2, 2022
1 parent 39389c3 commit d2cce74
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions catalyst-toolbox/src/rewards/veterans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,20 @@ fn calc_final_ranking_consensus_per_review(rankings: &[impl Borrow<VeteranRankin
let rankings_majority = Decimal::from(rankings.len()) / Decimal::from(2);
let ranks = rankings.iter().counts_by(|r| r.borrow().score());

match (ranks.get(&FilteredOut), ranks.get(&Excellent)) {
(Some(filtered_out), _) if Decimal::from(*filtered_out) >= rankings_majority => {
match (ranks.get(&FilteredOut), ranks.get(&Excellent), ranks.get(&Good)) {
(Some(filtered_out), _, _) if Decimal::from(*filtered_out) >= rankings_majority => {
Decimal::from(*filtered_out) / Decimal::from(rankings.len())
}
(_, Some(excellent)) if Decimal::from(*excellent) > rankings_majority => {
(_, Some(excellent), _) if Decimal::from(*excellent) > rankings_majority => {
Decimal::from(*excellent) / Decimal::from(rankings.len())
}
_ => Decimal::from(*ranks.get(&Good).unwrap()) / Decimal::from(rankings.len()),
(_, Some(excellent), Some(good)) => {
(Decimal::from(*excellent) + Decimal::from(*good)) / Decimal::from(rankings.len())
}
(_, _, Some(good)) => {
Decimal::from(*good) / Decimal::from(rankings.len())
}
_ => Decimal::ONE,
}
}

Expand Down

0 comments on commit d2cce74

Please sign in to comment.