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 %>
6 <!-- This table shows how many times each choice was ranked above the other,
8 <table class="preftable">
11 <% candidates.each do |candidate| -%>
12 <th><%=h @names[candidate] -%></th>
16 <% candidates.each do |winner| -%>
18 <th><%=h @names[winner] %></th>
19 <% candidates.each do |loser| -%>
20 <% if winner == loser -%>
23 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
25 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
26 :diameter => 25, :share_color => '#74ce00' %>
34 <!-- This table generates a margin of victory -->
35 <table class="preftable">
36 <% candidates.each do |victor| %>
38 <th><%=h @names[victor] %></th>
39 <% victories[victor].keys.each do |loser| %>
40 <% margin = victories[victor][loser]%>
41 <td><%=h @names[loser] %>