X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/25862916f9c97687bc1b30299fd9d544b0ba62ac..4c5046ffa16ea77da4e4b69517dcb33bc6ec2646:/app/views/quickvote/_pref_table.rhtml?ds=inline diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index 4576a0f..011fcbe 100644 --- a/app/views/quickvote/_pref_table.rhtml +++ b/app/views/quickvote/_pref_table.rhtml @@ -1,6 +1,6 @@ <% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%> <% voters = @election.voters.size %> - +<% matrix = @election.condorcet_result.matrix %> <% names = Hash.new -%> <% candidates.each do |candidate| -%> <%names[candidate] = Candidate.find(candidate).name -%> @@ -9,16 +9,18 @@ <% candidates.each do |candidate| -%> - <%= names[candidate] -%> - <% end -%> + <%=h names[candidate] -%> + <% end -%> + + <% candidates.each do |winner| -%> - <%= names[winner] %> + <%=h names[winner] %> <% candidates.each do |loser| -%> <% if winner == loser -%> -- - <% else %> - <% wins = @election.condorcet_result.matrix[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' %> @@ -27,4 +29,4 @@ <% end -%> <% end -%> - +