1 <% candidates = @election.condorcet_result.ranked_candidates.flatten -%>
2 <% voters = @election.voters.size %>
3 <% matrix = @election.condorcet_result.matrix %>
4 <% victories = @election.condorcet_result.victories_and_ties %>
5 <% names = @election.names_by_id %>
8 <!-- This table shows how many times each choice was ranked above the other,
10 <table class="voterbox">
13 <% candidates.each do |candidate| -%>
14 <th><%=h names[candidate] -%></th>
18 <% candidates.each do |winner| -%>
20 <th><%=h names[winner] %></th>
21 <% candidates.each do |loser| -%>
22 <% if winner == loser -%>
25 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
27 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
28 :diameter => 25, :share_color => '#74ce00' %>
36 <!-- This table generates a margin of victory -->
37 <table class="voterbox">
38 <% candidates.each do |victor| %>
40 <th><%=h names[victor] %></th>
41 <% victories[victor].keys.each do |loser| %>
42 <% margin = victories[victor][loser]%>
43 <td><%=h names[loser] %>