X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/1e8c21d4c4c93721c16a669e330a6d4e60483919..de7ac9ab65e04dbb81165e4317894a0e160ac9be:/app/views/common/_pref_tables.rhtml?ds=sidebyside diff --git a/app/views/common/_pref_tables.rhtml b/app/views/common/_pref_tables.rhtml index 7701985..3a53144 100644 --- a/app/views/common/_pref_tables.rhtml +++ b/app/views/common/_pref_tables.rhtml @@ -2,7 +2,6 @@ <% voters = @election.voters.size %> <% matrix = @election.ssd_result.matrix %> <% victories = @election.ssd_result.victories_and_ties %> -

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 top of the left column.

@@ -14,13 +13,13 @@ top of the left column.

<% candidates.each do |candidate| -%> - <%=h @names[candidate] -%> + <%= white_list(@names[candidate]) -%> <% end -%> <% candidates.each do |winner| -%> - <%=h @names[winner] %> + <%= white_list(@names[winner]) %> <% candidates.each do |loser| -%> <% if winner == loser -%> -- @@ -46,14 +45,17 @@ parenthesis.

<% candidates.each do |victor| %> - - <% victories[victor].keys.each do |loser| %> - <% margin = victories[victor][loser]%> - + + <% sorted = victories[victor].sort { |first,second| first[1] <=> second[1] }%> + <% sorted.each do |loserpair| %> + <% end -%> @@ -62,3 +64,4 @@ parenthesis.

<%=h @names[victor] %><%=h @names[loser] %> - <% if margin == 0%> + <%= white_list(@names[victor]) %><%= white_list(@names[loserpair[0]]) %> + <% if loserpair[1] == 0%> Tied! <% else -%> - (<%= margin%>) + (<%= loserpair[1] %>) <% end -%>
+