-<% candidates = @election.condorcet_result.ranked_candidates.flatten -%>
-<% voters = @election.voters.size %>
-<% matrix = @election.condorcet_result.matrix %>
-<% victories = @election.condorcet_result.victories_and_ties %>
-<% names = @election.names_by_id %>
-
-<!-- This table shows how many times each choice was ranked above the other,
- with percentages-->
-<table class="voterbox">
- <tr>
- <td> </td>
- <% candidates.each do |candidate| -%>
- <th><%=h names[candidate] -%></th>
- <% end -%>
- </tr>
-
-<% candidates.each do |winner| -%>
- <tr>
- <th><%=h names[winner] %></th>
- <% candidates.each do |loser| -%>
- <% if winner == loser -%>
- <td> -- </td>
- <% else %>
- <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
- <%= wins %>
- <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
- :diameter => 25, :share_color => '#74ce00' %>
- </td>
- <% end -%>
- <% end -%>
- </tr>
-<% end -%>
-</table>
-
-<!-- This table generates a margin of victory -->
-<table class="voterbox">
- <% candidates.each do |victor| %>
- <tr>
- <th><%=h names[victor] %></th>
- <% victories[victor].keys.each do |loser| %>
- <% margin = victories[victor][loser]%>
- <td><%=h names[loser] %>
- <% if margin == 0%>
- Tied!
- <% else -%>
- (<%= margin%>)
- <% end -%>
- </td>
- <% end -%>
- </tr>
- <% end -%>
-</table>