X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/baf9ff0ec39c13f52ee8d4f087641dc5fcc9c53b..4e7a42adf9f2cb9319265596d73ed10d978e5f81:/app/views/quickvote/_pref_table.rhtml diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index 32f5de4..a3ba63d 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 %> + <% 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] %> + <% 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 -%> <% end -%> - +