From 49feb09bf8aa2699e7b9e09e033832530a53f3f5 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Wed, 28 Jul 2021 00:12:57 +1000 Subject: [PATCH] Prefer election by quota/VRE to early bulk election --- src/stv/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/stv/mod.rs b/src/stv/mod.rs index 84b15e7..8884c6d 100644 --- a/src/stv/mod.rs +++ b/src/stv/mod.rs @@ -846,13 +846,6 @@ fn elect_sure_winners<'a, N: Number>(state: &mut CountState<'a, N>, opts: &STVOp /// Declare elected all candidates meeting the quota, and (if enabled) any candidates who can be early bulk elected because they have sufficiently many votes fn elect_hopefuls<'a, N: Number>(state: &mut CountState<'a, N>, opts: &STVOptions) -> Result { - // Determine if early bulk election can be effected - if opts.early_bulk_elect { - if elect_sure_winners(state, opts)? { - return Ok(true); - } - } - let mut cands_meeting_quota: Vec<(&Candidate, &CountCard)> = state.election.candidates.iter() // Present in order in case of tie .map(|c| (c, &state.candidates[c])) .filter(|(_, cc)| { (cc.state == CandidateState::Hopeful || cc.state == CandidateState::Guarded) && meets_vre(state, cc, opts) }) @@ -918,6 +911,13 @@ fn elect_hopefuls<'a, N: Number>(state: &mut CountState<'a, N>, opts: &STVOption } } + // Determine if early bulk election can be effected + if opts.early_bulk_elect { + if elect_sure_winners(state, opts)? { + return Ok(true); + } + } + return Ok(elected); }