% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%> <% voters = @election.voters.size %> <% names = Hash.new -%> <% candidates.each do |candidate| -%> <%names[candidate] = Candidate.find(candidate).name -%> <% end -%>
<% candidates.each do |candidate| -%> | <%=h names[candidate] -%> | <% end -%> <% candidates.each do |winner| -%>|
---|---|---|
<%=h names[winner] %> | <% candidates.each do |loser| -%> <% if winner == loser -%>-- | <% else %><% wins = @election.condorcet_result.matrix[winner][loser]%> <%=h wins %> <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie', :diameter => 25, :share_color => '#74ce00' %> | <% end -%> <% end -%>