X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/8ae0d71896fa022dd80e5a5de993e1382564fcb1..ee7a5c7130df812e96922e9f47ed9355cc78e72c:/app/views/quickvote/_pref_table.rhtml diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index 32f5de4..011fcbe 100644 --- a/app/views/quickvote/_pref_table.rhtml +++ b/app/views/quickvote/_pref_table.rhtml @@ -1,4 +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 -%> @@ -7,18 +9,24 @@ <% 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 %> - <%= @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' %> + <% end -%> <% end -%> <% end -%> - +