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">
12 <% candidates.each do |candidate| -%>
13 <th><%=h @names[candidate] -%></th>
17 <% candidates.each do |winner| -%>
19 <th><%=h @names[winner] %></th>
20 <% candidates.each do |loser| -%>
21 <% if winner == loser -%>
24 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
26 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
27 :diameter => 25, :share_color => '#74ce00' %>
35 <!-- This table generates a margin of victory -->
36 <table class="preftable">
37 <% candidates.each do |victor| %>
39 <th><%=h @names[victor] %></th>
40 <% victories[victor].keys.each do |loser| %>
41 <% margin = victories[victor][loser]%>
42 <td><%=h @names[loser] %>