Browse Source

Remove unnecessary columns in election summary for single seat elections. Fix #27

tags/last-sinatra-version
Adrian Short 8 years ago
parent
commit
af79c5d68e
1 changed files with 22 additions and 19 deletions
  1. +22
    -19
      views/electionsummary.haml

+ 22
- 19
views/electionsummary.haml View File

@@ -69,13 +69,14 @@
%th.highlight seats won
%th votes
%th % votes
%th % seats
%th votes per seat
%th candidates
%th votes per candidate
-#
%th relative popularity
- @max_votes_per_candidate = @results_by_party.first.votez.to_f / @results_by_party.first.cands.to_f # We really need to scan the array for the max value
- if @total_seats > 1
%th % seats
%th votes per seat
%th candidates
%th votes per candidate
-#
%th relative popularity
- @max_votes_per_candidate = @results_by_party.first.votez.to_f / @results_by_party.first.cands.to_f # We really need to scan the array for the max value
- @results_by_party.each do |row|
%tr
%td{ :style => "background-color: #{row.colour}" }  
@@ -84,14 +85,15 @@
%td.data_votes.right= commify(row.votez)
- if @election_held
%td.right= format_percent(row.votez.to_f / @total_votes * 100)
%td.right= format_percent(row.seatz.to_f / @total_seats * 100)
%td.data_votes_per_seat.right
- if row.seatz > 0
= commify(row.votez / row.seatz)
- else
—
%td.data_candidates.right= row.cands
- if @election_held
- if @total_seats > 1
%td.right= format_percent(row.seatz.to_f / @total_seats * 100)
%td.data_votes_per_seat.right
- if row.seatz > 0
= commify(row.votez / row.seatz)
- else
—
%td.data_candidates.right= row.cands
- if @election_held && @total_seats > 1
%td.right= commify(row.votez / row.cands)
-#
%td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
@@ -103,10 +105,11 @@
%td.right.highlight= @total_seats
%td.right= commify(@total_votes)
%td  
%td  
%td  
%td.right= commify(@election.candidacies.count)
%td  
- if @total_seats > 1
%td  
%td  
%td.right= commify(@election.candidacies.count)
%td  

- if @election.ballot_papers_issued
%table


Loading…
Cancel
Save