% candidates = @election.condorcet_result.ranked_candidates.flatten -%>
<% voters = @election.voters.size %>
<% matrix = @election.condorcet_result.matrix %>
<% victories = @election.condorcet_result.victories_and_ties %>
|
<% candidates.each do |candidate| -%>
<%=h @names[candidate] -%> |
<% end -%>
<% candidates.each do |winner| -%>
<%=h @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 -%>
<% end -%>
<% candidates.each do |victor| %>
<%=h @names[victor] %> |
<% victories[victor].keys.each do |loser| %>
<% margin = victories[victor][loser]%>
<%=h @names[loser] %>
<% if margin == 0%>
Tied!
<% else -%>
(<%= margin%>)
<% end -%>
|
<% end -%>
<% end -%>