Просмотр исходного кода

Add number of candidates in each district to districts contested table; make both tables easy to copy and paste

tags/last-sinatra-version
Adrian Short 12 лет назад
Родитель
Сommit
632db20485
2 измененных файлов: 18 добавлений и 16 удалений
  1. +2
    -1
      app.rb
  2. +16
    -15
      views/electionsummary.haml

+ 2
- 1
app.rb Просмотреть файл

@@ -118,7 +118,8 @@ get '/bodies/:body/elections/:date' do
d.name,
d.slug AS district_slug,
SUM(c.seats) AS seats,
SUM(c.votes) AS votez
SUM(c.votes) AS votez,
COUNT(c.id) AS num_candidates
FROM districts d, candidacies c



+ 16
- 15
views/electionsummary.haml Просмотреть файл

@@ -50,8 +50,8 @@
%table
%tr.header
%th
%th
%th  
%th  
%th.highlight seats won
%th votes
%th % seats
@@ -82,26 +82,25 @@
%tr.footer
%td
%td
%td  
%td  
%td.right.highlight= @total_seats
%td.right= commify(@total_votes)
%td
%td
%td
%td
%td
-#
%td
%td  
%td  
%td  
%td  
%td  
%h2
Results by
= @election.body.district_name
= @election.body.district_name.capitalize.pluralize(2)
contested in this election
%table
%tr.header
%th
%th  
%th seats
%th candidates
%th votes
- @results_by_district.each do |row|
%tr
@@ -109,10 +108,12 @@
%a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
= row.name
%td.right= row.seats
%td.right= row.num_candidates
%td.right= commify(row.votez)
%tr.footer
%td
%td  
%td.right= @total_seats
%td.right= @election.candidacies.count
%td.right= commify(@total_votes)
- else
%p Full details and results will be available on this page.

Загрузка…
Отмена
Сохранить