File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
catalyst-toolbox/src/rewards Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -81,14 +81,20 @@ fn calc_final_ranking_consensus_per_review(rankings: &[impl Borrow<VeteranRankin
81
81
let rankings_majority = Decimal :: from ( rankings. len ( ) ) / Decimal :: from ( 2 ) ;
82
82
let ranks = rankings. iter ( ) . counts_by ( |r| r. borrow ( ) . score ( ) ) ;
83
83
84
- match ( ranks. get ( & FilteredOut ) , ranks. get ( & Excellent ) ) {
85
- ( Some ( filtered_out) , _) if Decimal :: from ( * filtered_out) >= rankings_majority => {
84
+ match ( ranks. get ( & FilteredOut ) , ranks. get ( & Excellent ) , ranks . get ( & Good ) ) {
85
+ ( Some ( filtered_out) , _, _ ) if Decimal :: from ( * filtered_out) >= rankings_majority => {
86
86
Decimal :: from ( * filtered_out) / Decimal :: from ( rankings. len ( ) )
87
87
}
88
- ( _, Some ( excellent) ) if Decimal :: from ( * excellent) > rankings_majority => {
88
+ ( _, Some ( excellent) , _ ) if Decimal :: from ( * excellent) > rankings_majority => {
89
89
Decimal :: from ( * excellent) / Decimal :: from ( rankings. len ( ) )
90
90
}
91
- _ => Decimal :: from ( * ranks. get ( & Good ) . unwrap ( ) ) / Decimal :: from ( rankings. len ( ) ) ,
91
+ ( _, Some ( excellent) , Some ( good) ) => {
92
+ ( Decimal :: from ( * excellent) + Decimal :: from ( * good) ) / Decimal :: from ( rankings. len ( ) )
93
+ }
94
+ ( _, _, Some ( good) ) => {
95
+ Decimal :: from ( * good) / Decimal :: from ( rankings. len ( ) )
96
+ }
97
+ _ => Decimal :: ONE ,
92
98
}
93
99
}
94
100
You can’t perform that action at this time.
0 commit comments