<% candidates = @election.ssd_result.ranked_candidates.flatten -%> <% voters = @election.voters.size %> <% matrix = @election.ssd_result.matrix %> <% victories = @election.ssd_result.victories_and_ties %> <% if candidates.size <= 7 -%> <% candidates.each do |candidate| -%> <% end -%> <% candidates.each do |winner| -%> <% candidates.each do |loser| -%> <% if winner == loser -%> <% else %> <% end -%> <% end -%> <% end -%>
Each number shows how many times the candidate on the left beat the matching candidate on the top. The Schulze/Condorcet winner is on the top of the left column.
<%=h @names[candidate] -%>
<%=h @names[winner] %> -- <% 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' %>

<% candidates.each do |victor| %> <% victories[victor].keys.each do |loser| %> <% margin = victories[victor][loser]%> <% 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.
<%=h @names[victor] %><%=h @names[loser] %> <% if margin == 0%> Tied! <% else -%> (<%= margin%>) <% end -%>
<% end -%>