X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/924aa1ff433ac4ccd2db5851e91038088be00a09..a16962155a3c3c6616bfe32c7216f3631836d38c:/app/views/quickvote/_pref_table.rhtml diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index dfcb6cc..4576a0f 100644 --- a/app/views/quickvote/_pref_table.rhtml +++ b/app/views/quickvote/_pref_table.rhtml @@ -1,19 +1,30 @@ -<% candidates = @election.candidates.sort.collect {|candidate| candidate.id} -%> +<% 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| -%> - + <% end -%> <% candidates.each do |winner| -%> - + <% candidates.each do |loser| -%> <% if winner == loser -%> <% else %> - + <% end -%> <% end -%> -<%end -%> \ No newline at end of file +<% end -%> +
<%= candidate -%><%= names[candidate] -%>
<%= winner %><%= names[winner] %> -- <%= @election.condorcet_result.matrix[winner][loser] %><% wins = @election.condorcet_result.matrix[winner][loser]%> + <%= wins %> + <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie', + :diameter => 25, :share_color => '#74ce00' %> +