@@ -82,6 +82,7 @@ pub fn calculate_results(
8282 threshold : f64 ,
8383 total_stake_threshold : f64 ,
8484) -> Result < Vec < Calculation > > {
85+ debug ! ( "calculating. threshold: {threshold}, total_stake_threshold: {total_stake_threshold}" ) ;
8586 let success_results = calculate_vote_difference_and_threshold_success (
8687 proposals,
8788 voteplans,
@@ -102,14 +103,14 @@ pub fn calculate_results(
102103 let ( total_result, threshold_success) = success_results[ proposal_id] ;
103104 let ( yes, no) = extract_yes_no_votes ( proposal, voteplan) ?;
104105
105- debug ! ( "" ) ;
106106 let funded = threshold_success && depletion > 0 && depletion >= proposal. proposal_funds ;
107107
108108 let not_funded_reason = match ( funded, threshold_success) {
109109 ( true , _) => None ,
110110 ( false , true ) => Some ( NotFundedReason :: OverBudget ) ,
111111 ( false , false ) => Some ( NotFundedReason :: ApprovalThreshold ) ,
112112 } ;
113+ debug ! ( "not funded reason: {not_funded_reason:?}" ) ;
113114
114115 if funded {
115116 depletion -= proposal. proposal_funds ;
@@ -173,11 +174,13 @@ fn calculate_approval_threshold(
173174
174175 let total = yes + no;
175176 let diff = yes as i64 - no as i64 ;
177+ debug ! ( "total: {total}, diff: {diff}" ) ;
176178
177179 let pass_total_threshold = total as f64 >= total_stake_threshold;
178180 let pass_relative_threshold = ( yes as f64 / no as f64 ) >= threshold;
179181 let success = pass_total_threshold && pass_relative_threshold;
180182
183+ debug ! ( "total_stake_threshold: {total_stake_threshold}, threshold: {threshold}" ) ;
181184 debug ! ( "success: {success}, total_threshold: {pass_total_threshold}, relative_threshold: {pass_relative_threshold}" ) ;
182185
183186 Ok ( ( diff, success) )
0 commit comments