Election results in the London Borough of Sutton.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

137 line
4.1 KiB

  1. - @page_title = "#{@election.body.name} #{@election.kind} #{long_date(@election.d)}"
  2. %nav
  3. %a{ :href => "/bodies/#{@election.body.slug}" }
  4. «
  5. = @election.body.name
  6. - if @elections_for_this_body.size > 1
  7. %p
  8. - @election_index = @elections_for_this_body.index(@election)
  9. - unless @election_index == 0
  10. - @previous_election = @elections_for_this_body[@election_index - 1]
  11. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@previous_election.d}", :title => "#{@previous_election.kind} #{short_date(@previous_election.d)}" }<
  12. &laquo;
  13. Previous
  14. = @election.body.name
  15. election
  16. &nbsp;&nbsp;&nbsp;
  17. - unless @election_index == @elections_for_this_body.size - 1
  18. - @next_election = @elections_for_this_body[@election_index + 1]
  19. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@next_election.d}", :title => "#{@next_election.kind} #{short_date(@next_election.d)}" }<
  20. Next
  21. = @election.body.name
  22. election
  23. &raquo;
  24. %h1
  25. = @election.body.name
  26. = @election.kind
  27. %br
  28. = long_date(@election.d)
  29. -# Does this election have any recorded votes, i.e. has it been held?
  30. - @election_held = Candidacy.sum(:votes, :election => @election)
  31. - unless @election_held
  32. .warning
  33. We don't have the results for this election yet.
  34. %p= @polling_station
  35. %p= @election.reason
  36. %p
  37. = @election.candidacies.count
  38. = "candidate".pluralize(@election.candidacies.count)
  39. - if @election_held
  40. contested
  41. - else
  42. will be contesting
  43. -# We can't calculate the number of seats being contested if the election hasn't been held
  44. - if @election_held
  45. = @total_seats
  46. = "seat".pluralize(@total_seats)
  47. in
  48. = @total_districts
  49. = @election.body.district_name.pluralize(@total_districts)
  50. in Sutton.
  51. - if @election_held
  52. %table
  53. %tr.header
  54. %th &nbsp;
  55. %th &nbsp;
  56. %th.highlight seats won
  57. %th votes
  58. %th % votes
  59. %th % seats
  60. %th votes per seat
  61. %th candidates
  62. %th votes per candidate
  63. -#
  64. %th relative popularity
  65. - @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
  66. - @results_by_party.each do |row|
  67. %tr
  68. %td{ :style => "background-color: #{row.colour}" } &nbsp;
  69. %td.data_party= row.name
  70. %td.data_seats.right.highlight= row.seatz
  71. %td.data_votes.right= commify(row.votez)
  72. - if @election_held
  73. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  74. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  75. %td.data_votes_per_seat.right
  76. - if row.seatz > 0
  77. = commify(row.votez / row.seatz)
  78. - else
  79. &mdash;
  80. %td.data_candidates.right= row.cands
  81. - if @election_held
  82. %td.right= commify(row.votez / row.cands)
  83. -#
  84. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  85. %tr.footer
  86. %td &nbsp;
  87. %td &nbsp;
  88. %td.right.highlight= @total_seats
  89. %td.right= commify(@total_votes)
  90. %td &nbsp;
  91. %td &nbsp;
  92. %td &nbsp;
  93. %td.right= commify(@election.candidacies.count)
  94. %td &nbsp;
  95. - if @election.ballot_papers_issued
  96. %table
  97. %tr
  98. %td Electorate
  99. %td.right= commify(@election.electorate)
  100. %tr
  101. %td Ballot papers issued
  102. %td.right= commify(@election.ballot_papers_issued)
  103. %tr
  104. %td Turnout
  105. %td.right= sprintf("%.0f%%", @election.ballot_papers_issued / @election.electorate.to_f * 100)
  106. %h2
  107. = "Candidate".pluralize(@total_seats)
  108. elected
  109. %table
  110. - @election.polls.each do |p|
  111. %tr
  112. %td
  113. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{p.district.slug}"}
  114. = p.district.name
  115. - p.successful_candidacies.each do |sc|
  116. %td{ :style => "background-color: #{sc.party.colour};" }
  117. -# %a{ :href => sc.candidate.url }
  118. = sc.candidate.short_name