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 -%>
8 <p>Each number in the table below shows how many times the candidate on
9 the left beat the matching candidate on the top. The winner is on the
10 top of the left column.</p>
12 <!-- This table shows how many times each choice was ranked above the other,
14 <div class="result_table">
15 <table class="preftable">
18 <% candidates.each do |candidate| -%>
19 <th><%=h @names[candidate] -%></th>
23 <% candidates.each do |winner| -%>
25 <th><%=h @names[winner] %></th>
26 <% candidates.each do |loser| -%>
27 <% if winner == loser -%>
30 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
32 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
33 :diameter => 25, :share_color => '#74ce00' %>
41 <!-- This table generates a margin of victory -->
43 <p>A simplification of the above data. The winner is on the left; each
44 cell names the defeated candidate and the magnitude of the victory in
47 <div class="result_table">
48 <table class="preftable">
49 <% candidates.each do |victor| %>
51 <th><%=h @names[victor] %></th>
52 <% victories[victor].keys.each do |loser| %>
53 <% margin = victories[victor][loser]%>
54 <td><%=h @names[loser] %>