X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/da6c29f53b3598a6d2d9959df277b0340bc54cee..ee280d9250b5b4c925cc6b4809ce40437d600e7d:/app/views/common/_pref_tables.rhtml?ds=inline diff --git a/app/views/common/_pref_tables.rhtml b/app/views/common/_pref_tables.rhtml index 7701985..3edc05a 100644 --- a/app/views/common/_pref_tables.rhtml +++ b/app/views/common/_pref_tables.rhtml @@ -1,7 +1,12 @@ + +<% @election.results! %> + + <% candidates = @election.ssd_result.ranked_candidates.flatten -%> <% voters = @election.voters.size %> <% matrix = @election.ssd_result.matrix %> <% victories = @election.ssd_result.victories_and_ties %> +<% @names = @election.names_by_id %>
Each number in the table below shows how many times the candidate on the left beat the matching candidate on the top. The winner is on the @@ -14,13 +19,13 @@ top of the left column.
<%=h @names[victor] %> | - <% victories[victor].keys.each do |loser| %> - <% margin = victories[victor][loser]%> -<%=h @names[loser] %> - <% if margin == 0%> + | <%= white_list(@names[victor]) %> | + + <% sorted = victories[victor].sort { |first,second| first[1] <=> second[1] }%> + <% sorted.each do |loserpair| %> +<%= white_list(@names[loserpair[0]]) %> + <% if loserpair[1] == 0%> Tied! <% else -%> - (<%= margin%>) + (<%= loserpair[1] %>) <% end -%> | <% end -%> @@ -62,3 +70,4 @@ parenthesis.
---|