Add signs to Votes display, change default to Votes (transposed)

This commit is contained in:
RunasSudo 2021-09-04 22:24:01 +10:00
parent a24ac3658a
commit ccc3266d2c
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
2 changed files with 10 additions and 10 deletions

View File

@ -189,8 +189,8 @@
<label style="margin-right:1em;"> <label style="margin-right:1em;">
Report style: Report style:
<select id="selReport"> <select id="selReport">
<option value="votes" selected>Votes only</option> <option value="votes">Votes only</option>
<option value="votes_transposed">Votes (transposed)</option> <option value="votes_transposed" selected>Votes (transposed)</option>
<option value="ballots_votes">Ballots and votes</option> <option value="ballots_votes">Ballots and votes</option>
</select> </select>
</label> </label>

View File

@ -423,15 +423,15 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
"votes" => { "votes" => {
match count_card.state { match count_card.state {
CandidateState::Hopeful | CandidateState::Guarded => { CandidateState::Hopeful | CandidateState::Guarded => {
result.push(&format!(r#"<td class="{}count">{}</td>"#, classes_i, pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count">{}</td>"#, classes_i, pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Elected => { CandidateState::Elected => {
result.push(&format!(r#"<td class="{}count elected">{}</td>"#, classes_i, pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count elected">{}</td>"#, classes_i, pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count elected">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count elected">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Doomed => { CandidateState::Doomed => {
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Withdrawn => { CandidateState::Withdrawn => {
@ -439,7 +439,7 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
result.push(&format!(r#"<td class="{}count excluded">WD</td>"#, classes_i).into()); result.push(&format!(r#"<td class="{}count excluded">WD</td>"#, classes_i).into());
} }
CandidateState::Excluded => { CandidateState::Excluded => {
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, classes_i, pps(&count_card.transfers, opts.pp_decimals)).into());
if count_card.votes.is_zero() && count_card.parcels.iter().all(|p| p.votes.is_empty()) { if count_card.votes.is_zero() && count_card.parcels.iter().all(|p| p.votes.is_empty()) {
result.push(&format!(r#"<td class="{}count excluded">Ex</td>"#, classes_i).into()); result.push(&format!(r#"<td class="{}count excluded">Ex</td>"#, classes_i).into());
} else { } else {
@ -498,15 +498,15 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
"ballots_votes" => { "ballots_votes" => {
match count_card.state { match count_card.state {
CandidateState::Hopeful | CandidateState::Guarded => { CandidateState::Hopeful | CandidateState::Guarded => {
result.push(&format!(r#"<td class="{}count">{}</td><td class="count">{}</td>"#, classes_i, pp(&count_card.ballot_transfers, 0), pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count">{}</td><td class="count">{}</td>"#, classes_i, pps(&count_card.ballot_transfers, 0), pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count">{}</td><td class="count">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count">{}</td><td class="count">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Elected => { CandidateState::Elected => {
result.push(&format!(r#"<td class="{}count elected">{}</td><td class="count elected">{}</td>"#, classes_i, pp(&count_card.ballot_transfers, 0), pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count elected">{}</td><td class="count elected">{}</td>"#, classes_i, pps(&count_card.ballot_transfers, 0), pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count elected">{}</td><td class="count elected">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count elected">{}</td><td class="count elected">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Doomed => { CandidateState::Doomed => {
result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pp(&count_card.ballot_transfers, 0), pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pps(&count_card.ballot_transfers, 0), pps(&count_card.transfers, opts.pp_decimals)).into());
result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pp(&count_card.num_ballots(), 0), pp(&count_card.votes, opts.pp_decimals)).into());
} }
CandidateState::Withdrawn => { CandidateState::Withdrawn => {
@ -514,7 +514,7 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
result.push(&format!(r#"<td class="{}count excluded"></td><td class="count excluded">WD</td>"#, classes_i).into()); result.push(&format!(r#"<td class="{}count excluded"></td><td class="count excluded">WD</td>"#, classes_i).into());
} }
CandidateState::Excluded => { CandidateState::Excluded => {
result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pp(&count_card.ballot_transfers, 0), pp(&count_card.transfers, opts.pp_decimals)).into()); result.push(&format!(r#"<td class="{}count excluded">{}</td><td class="count excluded">{}</td>"#, classes_i, pps(&count_card.ballot_transfers, 0), pps(&count_card.transfers, opts.pp_decimals)).into());
if count_card.votes.is_zero() && count_card.parcels.iter().all(|p| p.votes.is_empty()) { if count_card.votes.is_zero() && count_card.parcels.iter().all(|p| p.votes.is_empty()) {
result.push(&format!(r#"<td class="{}count excluded"></td><td class="count excluded">Ex</td>"#, classes_i).into()); result.push(&format!(r#"<td class="{}count excluded"></td><td class="count excluded">Ex</td>"#, classes_i).into());
} else { } else {