1 <% candidates = @election.ssd_result.ranked_candidates.flatten -%>
2 <% voters = @election.voters.size %>
3 <% matrix = @election.ssd_result.matrix %>
4 <% victories = @election.ssd_result.victories_and_ties %>
6 <% if candidates.size <= 7 -%>
7 <!-- This table shows how many times each choice was ranked above the other,
9 <table class="preftable">
10 <caption>Each number shows how many times the candidate on the left beat the
11 matching candidate on the top. The Schulze/Condorcet winner is on the top of the
12 left column.</caption>
15 <% candidates.each do |candidate| -%>
16 <th><%=h @names[candidate] -%></th>
20 <% candidates.each do |winner| -%>
22 <th><%=h @names[winner] %></th>
23 <% candidates.each do |loser| -%>
24 <% if winner == loser -%>
27 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
29 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
30 :diameter => 25, :share_color => '#74ce00' %>
38 <!-- This table generates a margin of victory -->
39 <table class="preftable">
40 <caption>A simplification of the above data. The winner is on the left; each cell
41 names the defeated candidate and the magnitude of the victory in parenthesis.
43 <% candidates.each do |victor| %>
45 <th><%=h @names[victor] %></th>
46 <% victories[victor].keys.each do |loser| %>
47 <% margin = victories[victor][loser]%>
48 <td><%=h @names[loser] %>