X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/0bcced90721389c27eb815ca8dcab85533417697..4c5046ffa16ea77da4e4b69517dcb33bc6ec2646:/app/views/quickvote/_pref_table.rhtml?ds=sidebyside diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index dfcb6cc..011fcbe 100644 --- a/app/views/quickvote/_pref_table.rhtml +++ b/app/views/quickvote/_pref_table.rhtml @@ -1,19 +1,32 @@ -<% candidates = @election.candidates.sort.collect {|candidate| candidate.id} -%> +<% 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 -%> +<% end -%> <% candidates.each do |candidate| -%> - - <% end -%> + + <% end -%> + + <% candidates.each do |winner| -%> - + <% candidates.each do |loser| -%> <% if winner == loser -%> - <% else %> - + <% else %> + <% end -%> <% end -%> -<%end -%> \ No newline at end of file +<% end -%> +
<%= candidate -%><%=h names[candidate] -%>
<%= winner %><%=h names[winner] %> -- <%= @election.condorcet_result.matrix[winner][loser] %><% 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' %> +