]> projects.mako.cc - selectricity-live/blob - app/views/quickvote/_pref_table.rhtml
Add some empty request testcases.
[selectricity-live] / app / views / quickvote / _pref_table.rhtml
1 <% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%>
2 <% voters = @election.voters.size %>
3
4 <% names = Hash.new -%>
5 <% candidates.each do |candidate| -%>
6         <%names[candidate] = Candidate.find(candidate).name -%>
7 <% end -%>
8 <table class="voterbox">
9   <tr>
10         <td> </td>
11         <% candidates.each do |candidate| -%>
12           <th><%= names[candidate] -%></th>
13         <% end -%>
14 <% candidates.each do |winner| -%>
15   <tr>
16         <th><%= names[winner] %></th>
17   <% candidates.each do |loser| -%> 
18     <% if winner == loser -%>
19       <td> -- </td>
20     <% else %>         
21       <td><% wins = @election.condorcet_result.matrix[winner][loser]%>
22           <%= wins %>
23               <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie', 
24                                  :diameter => 25, :share_color => '#74ce00' %>
25           </td>
26     <% end -%>
27   <% end -%>
28  </tr>
29 <% end -%>
30

Benjamin Mako Hill || Want to submit a patch?