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
8181 let rankings_majority = Decimal :: from ( rankings. len ( ) ) / Decimal :: from ( 2 ) ;
8282 let ranks = rankings. iter ( ) . counts_by ( |r| r. borrow ( ) . score ( ) ) ;
8383
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 => {
8686 Decimal :: from ( * filtered_out) / Decimal :: from ( rankings. len ( ) )
8787 }
88- ( _, Some ( excellent) ) if Decimal :: from ( * excellent) > rankings_majority => {
88+ ( _, Some ( excellent) , _ ) if Decimal :: from ( * excellent) > rankings_majority => {
8989 Decimal :: from ( * excellent) / Decimal :: from ( rankings. len ( ) )
9090 }
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 ,
9298 }
9399}
94100
You can’t perform that action at this time.
0 commit comments