% candidates = @election.ssd_result.ranked_candidates.flatten -%> <% voters = @election.voters.size %> <% matrix = @election.ssd_result.matrix %> <% victories = @election.ssd_result.victories_and_ties %>
Each number in the table below shows how many times the candidate on the left beat the matching candidate on the top. The winner is on the top of the left column.
<% candidates.each do |candidate| -%> | <%= white_list(@names[candidate]) -%> | <% end -%>|
---|---|---|
<%= white_list(@names[winner]) %> | <% candidates.each do |loser| -%> <% if winner == loser -%>-- | <% else %><% wins = matrix[winner][loser] unless matrix[winner].nil?%> <%= wins %> <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie', :diameter => 25, :share_color => '#74ce00' %> | <% end -%> <% end -%>
A simplification of the above data. The winner is on the left; each cell names the defeated candidate and the magnitude of the victory in parenthesis.
<%= white_list(@names[victor]) %> | <% victories[victor].keys.each do |loser| %> <% margin = victories[victor][loser]%><%= white_list(@names[loser]) %> <% if margin == 0%> Tied! <% else -%> (<%= margin%>) <% end -%> | <% end -%>
---|