Show keep values for elected candidates in Meek STV
This commit is contained in:
parent
d34057d03a
commit
ca54b94953
10
src/main.rs
10
src/main.rs
|
@ -250,14 +250,18 @@ where
|
|||
let mut winners = Vec::new();
|
||||
for (candidate, count_card) in state.candidates.iter() {
|
||||
if count_card.state == CandidateState::Elected {
|
||||
winners.push((candidate, count_card.order_elected));
|
||||
winners.push((candidate, count_card));
|
||||
}
|
||||
}
|
||||
winners.sort_unstable_by(|a, b| a.1.partial_cmp(&b.1).unwrap());
|
||||
winners.sort_unstable_by(|a, b| a.1.order_elected.partial_cmp(&b.1.order_elected).unwrap());
|
||||
|
||||
for (i, (winner, _)) in winners.into_iter().enumerate() {
|
||||
for (i, (winner, count_card)) in winners.into_iter().enumerate() {
|
||||
if let Some(kv) = &count_card.keep_value {
|
||||
println!("{}. {} (kv = {:.dps2$})", i + 1, winner.name, kv, dps2=max(stv_opts.pp_decimals, 2));
|
||||
} else {
|
||||
println!("{}. {}", i + 1, winner.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_candidates<'a, N: 'a + Number, I: Iterator<Item=(&'a Candidate, &'a CountCard<'a, N>)>>(candidates: I, cmd_opts: &STV) {
|
||||
|
|
Loading…
Reference in New Issue