summaryrefslogtreecommitdiff
path: root/app/views/tournaments/standings.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tournaments/standings.html.erb')
-rw-r--r--app/views/tournaments/standings.html.erb20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/views/tournaments/standings.html.erb b/app/views/tournaments/standings.html.erb
index 28d3c22..b8739de 100644
--- a/app/views/tournaments/standings.html.erb
+++ b/app/views/tournaments/standings.html.erb
@@ -1,4 +1,7 @@
-<% playerscores = @tournament.players.collect {|player| player => tournament.statistics.getStatistic(player.matches.last, player, :score) } %>
+<% playerscores = @tournament.players.collect {|player| player => @tournament.statistics.getStatistic(player.matches.last, player, :score) } %>
+<% teams = tournament_stage.matches.collect
+{ |match| match.teams.collect { |team| team.id => team.players.collect
+{ |player| player.user_name => @tournament.statistics.getStatistic(player.matches.last, player, :score } } } %>
<table>
<tr>
@@ -9,4 +12,17 @@
<% place += 1%>
<% end %>
</tr>
-</table> \ No newline at end of file
+</table>
+
+<% teams.each do |team| %>
+ <table>
+ <tr>
+ <td>Standings:</td>
+ <% place = 0 %>
+ <% team.values.sort {|player1, player2| playerscores[player1] <=> playerscores[player2] }.each |player| %>
+ <td><%= place.to_s + ":" %> <%= player.user_name %></td>
+ <% place += 1%>
+ <% end %>
+ </tr>
+ </table>
+<% end %> \ No newline at end of file