- <th><%=h @names[victor] %></th>
- <% victories[victor].keys.each do |loser| %>
- <% margin = victories[victor][loser]%>
- <td><%=h @names[loser] %>
- <% if margin == 0%>
+ <th><%= white_list(@names[victor]) %></th>
+<!-- This is a pretty logic heavy section - think about trying to move it to
+ backend eventually. Change the order of first and second to change the order
+ that things are sorted in. -->
+ <% sorted = victories[victor].sort { |first,second| first[1] <=> second[1] }%>
+ <% sorted.each do |loserpair| %>
+ <td><%= white_list(@names[loserpair[0]]) %>
+ <% if loserpair[1] == 0%>