summaryrefslogtreecommitdiff
path: root/app/views/tournaments
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-27 02:33:28 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-27 02:33:28 -0400
commit5301997c80401e0fa5d106dd4dbcd330b4708cfb (patch)
tree04841a2f16791d9213c58b19ec612fc5fbaf651f /app/views/tournaments
parent79b903fc5632242a6ab1ee0f7732dec168331703 (diff)
Added a standings view and used spaceships.
Diffstat (limited to 'app/views/tournaments')
-rw-r--r--app/views/tournaments/standings.html.erb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/views/tournaments/standings.html.erb b/app/views/tournaments/standings.html.erb
new file mode 100644
index 0000000..28d3c22
--- /dev/null
+++ b/app/views/tournaments/standings.html.erb
@@ -0,0 +1,12 @@
+<% playerscores = @tournament.players.collect {|player| player => tournament.statistics.getStatistic(player.matches.last, player, :score) } %>
+
+<table>
+ <tr>
+ <td>Standings:</td>
+ <% place = 0 %>
+ <% playerscores.sort {|player1, player2| playerscores[player1] <=> playerscores[player2] }.each |player| %>
+ <td><%= place.to_s + ":" %> <%= player.user_name %></td>
+ <% place += 1%>
+ <% end %>
+ </tr>
+</table> \ No newline at end of file