1 <% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%>
2 <% voters = @election.voters.size %>
3 <% matrix = @election.condorcet_result.matrix %>
4 <% names = Hash.new -%>
5 <% candidates.each do |candidate| -%>
6 <%names[candidate] = Candidate.find(candidate).name -%>
8 <table class="voterbox">
11 <% candidates.each do |candidate| -%>
12 <th><%=h names[candidate] -%></th>
16 <% candidates.each do |winner| -%>
18 <th><%=h names[winner] %></th>
19 <% candidates.each do |loser| -%>
20 <% if winner == loser -%>
23 <td><% wins = matrix[winner][loser] unless matrix[winner].nil?%>
25 <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie',
26 :diameter => 25, :share_color => '#74ce00' %>