From 5301997c80401e0fa5d106dd4dbcd330b4708cfb Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Sun, 27 Apr 2014 02:33:28 -0400 Subject: Added a standings view and used spaceships. --- app/views/tournaments/standings.html.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/views/tournaments/standings.html.erb (limited to 'app/views/tournaments') 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) } %> + + + + + <% place = 0 %> + <% playerscores.sort {|player1, player2| playerscores[player1] <=> playerscores[player2] }.each |player| %> + + <% place += 1%> + <% end %> + +
Standings:<%= place.to_s + ":" %> <%= player.user_name %>
\ No newline at end of file -- cgit v1.2.3-54-g00ecf