Show keep values for elected candidates in Meek STV
This commit is contained in:
parent
d34057d03a
commit
ca54b94953
12
src/main.rs
12
src/main.rs
@ -250,13 +250,17 @@ 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() {
|
||||
println!("{}. {}", i + 1, winner.name);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user