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 <p>Each number in the table below shows how many times the candidate on
7 the left beat the matching candidate on the top. The winner is on the
8 top of the left column.</p>
10 <!-- This table shows how many times each choice was ranked above the other,
12 <div class="result_table">
13 <table class="preftable">
16 <% candidates.each do |candidate| -%>
17 <th><%= white_list(@names[candidate]) -%></th>
21 <% candidates.each do |winner| -%>
23 <th><%= white_list(@names[winner]) %></th>
24 <% candidates.each do |loser| -%>
25 <% if winner == loser -%>
28 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
30 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
31 :diameter => 25, :share_color => '#74ce00' %>
39 <!-- This table generates a margin of victory -->
41 <p>A simplification of the above data. The winner is on the left; each
42 cell names the defeated candidate and the magnitude of the victory in
45 <div class="result_table">
46 <table class="preftable">
47 <% candidates.each do |victor| %>
49 <th><%= white_list(@names[victor]) %></th>
50 <% victories[victor].keys.each do |loser| %>
51 <% margin = victories[victor][loser]%>
52 <td><%= white_list(@names[loser]) %>