Correct number of ballot papers reported to be transferred in exclusive Gregory method

This commit is contained in:
RunasSudo 2021-08-17 01:56:43 +10:00
parent baffdce9e3
commit b9e66fde73
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A

View File

@ -253,9 +253,7 @@ where
state.title = String::from(&elected_candidate.name);
state.logger.log_literal(format!("Surplus of {} distributed.", elected_candidate.name));
let count_card = state.candidates.get_mut(elected_candidate).unwrap();
count_card.ballot_transfers = -count_card.num_ballots();
let count_card = &state.candidates[elected_candidate];
let surplus = &count_card.votes - state.quota.as_ref().unwrap();
// Determine which votes to examine
@ -311,6 +309,9 @@ where
let total_ballots = &transferable_ballots + &exhausted_ballots;
let total_votes = &transferable_votes + &exhausted_votes;
let count_card = state.candidates.get_mut(elected_candidate).unwrap();
count_card.ballot_transfers = -&total_ballots;
let surplus_denom = calculate_surplus_denom(&surplus, &transferable_ballots, &transferable_votes, &total_ballots, &total_votes, is_weighted, opts.transferable_only);
let mut surplus_fraction;
match surplus_denom {