Browse Source

Don't show results by party table if this poll only elects one candidate

tags/last-sinatra-version
Adrian Short 9 years ago
parent
commit
be94b22a3e
1 changed files with 46 additions and 45 deletions
  1. +46
    -45
      views/resultsdistrict.haml

+ 46
- 45
views/resultsdistrict.haml View File

@@ -92,53 +92,54 @@
%a{ :href => "?wiki=dokuwiki" }
DokuWiki

%h2 Votes by party
- if @total_seats > 1
%h2 Votes by party

%table
%tr.header
%th  
%th  
%th  
%th.right.highlight seats won
%th candidates
%th.right votes
%th.right % votes
%th.right votes per candidate
- count = 0
%table
%tr.header
%th  
%th  
%th  
%th.right.highlight seats won
%th candidates
%th.right votes
%th.right % votes
%th.right votes per candidate
- count = 0
- @results_by_party.each do |row|
- count += 1
%tr
%td.right= count
%td{ :style => "background-color: #{row['party_colour'] }" }  
%td= row['party_name']
- if @election_held
%td.right.highlight= row['num_seats']
- else
%td.right.highlight —
%td.right= row['num_candidates']
- if @election_held
%td.right= commify(row['total_votes'])
%td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
%td.right= commify(row['total_votes'] / row['num_candidates'])
- else
%td.right —
%td.right —
%td.right —
- @results_by_party.each do |row|
- count += 1
%tr
%td.right= count
%td{ :style => "background-color: #{row['party_colour'] }" }  
%td= row['party_name']
- if @election_held
%td.right.highlight= row['num_seats']
- else
%td.right.highlight —
%td.right= row['num_candidates']
- if @election_held
%td.right= commify(row['total_votes'])
%td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
%td.right= commify(row['total_votes'] / row['num_candidates'])
- else
%td.right —
%td.right —
%td.right —
%tr.footer
%td  
%td  
%td  
- if @election_held
%td.right.highlight= @total_seats
- else
%td.right.highlight  
%td.right= @total_candidates
%td.right= commify(@total_votes)
%td  
%td  
%tr.footer
%td  
%td  
%td  
- if @election_held
%td.right.highlight= @total_seats
- else
%td.right.highlight  
%td.right= @total_candidates
%td.right= commify(@total_votes)
%td  
%td  

- if @poll
%p


Loading…
Cancel
Save