]> projects.mako.cc - selectricity/blob - app/views/quickvote/_pref_table.rhtml
* Validate that quickvote.name is not nil
[selectricity] / app / views / quickvote / _pref_table.rhtml
1 <% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%>
2 <% names = Hash.new -%>
3 <% candidates.each do |candidate| -%>
4         <%names[candidate] = Candidate.find(candidate).name -%>
5 <% end -%>
6 <table class="voterbox">
7   <tr>
8         <td> </td>
9         <% candidates.each do |candidate| -%>
10           <th><%= names[candidate] -%></th>
11         <% end -%>
12 <% candidates.each do |winner| -%>
13   <tr>
14         <th><%= names[winner] %></th>
15   <% candidates.each do |loser| -%> 
16     <% if winner == loser -%>
17       <td> -- </td>
18     <% else %>         
19       <td><%= @election.condorcet_result.matrix[winner][loser] %></td>
20     <% end -%>
21   <% end -%>
22  </tr>
23 <% end -%>
24

Benjamin Mako Hill || Want to submit a patch?