X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/0bcced90721389c27eb815ca8dcab85533417697..4e7a42adf9f2cb9319265596d73ed10d978e5f81:/app/views/quickvote/_pref_table.rhtml diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index dfcb6cc..a3ba63d 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 %> + +<% names = Hash.new -%> +<% candidates.each do |candidate| -%> + <%names[candidate] = Candidate.find(candidate).name -%> +<% end -%>
<% candidates.each do |candidate| -%> - | <%= candidate -%> | - <% end -%> +<%=h names[candidate] -%> | + <% end -%> +||
---|---|---|---|---|
<%= 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 -%>