Show total vote in report

This commit is contained in:
RunasSudo 2021-05-29 23:25:27 +10:00
parent 8a92c17cb3
commit f4fdf64072
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -113,8 +113,6 @@ where
// Distribute first preferences // Distribute first preferences
stv::count_init(&mut state, &stv_opts); stv::count_init(&mut state, &stv_opts);
// Display
let mut stage_num = 1; let mut stage_num = 1;
make_and_print_result(stage_num, &state, &cmd_opts); make_and_print_result(stage_num, &state, &cmd_opts);
@ -187,6 +185,11 @@ fn print_stage<N: Number>(stage_num: usize, result: &StageResult<N>, cmd_opts: &
println!("Exhausted: {:.dps$} ({:.dps$})", state.exhausted.votes, state.exhausted.transfers, dps=cmd_opts.pp_decimals); println!("Exhausted: {:.dps$} ({:.dps$})", state.exhausted.votes, state.exhausted.transfers, dps=cmd_opts.pp_decimals);
println!("Loss by fraction: {:.dps$} ({:.dps$})", state.loss_fraction.votes, state.loss_fraction.transfers, dps=cmd_opts.pp_decimals); println!("Loss by fraction: {:.dps$} ({:.dps$})", state.loss_fraction.votes, state.loss_fraction.transfers, dps=cmd_opts.pp_decimals);
let mut total_vote = state.candidates.values().fold(N::zero(), |acc, cc| { acc + &cc.votes });
total_vote += &state.exhausted.votes;
total_vote += &state.loss_fraction.votes;
println!("Total votes: {:.dps$}", total_vote, dps=cmd_opts.pp_decimals);
println!("Quota: {:.dps$}", state.quota, dps=cmd_opts.pp_decimals); println!("Quota: {:.dps$}", state.quota, dps=cmd_opts.pp_decimals);
println!(""); println!("");