Skip to content

Commit

Permalink
rankings now work!
Browse files Browse the repository at this point in the history
Fixes #171
  • Loading branch information
santiaago committed Mar 4, 2014
1 parent 0d782dd commit e4e9dbf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions static/js/controllers/teamControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,7 @@ teamControllers.controller('TeamRankingCtrl', ['$scope', '$routeParams', 'Team',
$scope.teamData = Team.get({ id:$routeParams.id });

$scope.rankingData = Team.ranking({id:$routeParams.id, rankby:$routeParams.rankby});
// predicate is udate for ranking tables
$scope.predicate = '';

}]);
2 changes: 2 additions & 0 deletions static/js/controllers/tournamentControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ tournamentControllers.controller('TournamentRankingCtrl', ['$scope', '$routePara
$scope.tournamentData = Tournament.get({ id:$routeParams.id });

$scope.rankingData = Tournament.ranking({id:$routeParams.id, rankby:$routeParams.rankby});
// predicate is udate for ranking tables
$scope.predicate = '';

}]);

9 changes: 7 additions & 2 deletions static/templates/teams/ranking.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ <h1>Team Ranking</h1>
<div ng-if="rankingData.Users">
<div class="players">
<table class="table table-striped">
<thead><tr><th>Players</th><th>Score</th></tr></thead>
<thead>
<tr>
<th>Players</th>
<th><a href="" ng-click="predicate = 'Score'; reverse=!reverse">Score</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="u in rankingData.Users">
<tr ng-repeat="u in rankingData.Users | orderBy:predicate:reverse">
<td><a href="/ng#/users/show/{{u.Id}}">{{u.Name}}</a></td>
<td>{{u.Score}}</td>
</tr>
Expand Down
20 changes: 15 additions & 5 deletions static/templates/tournaments/ranking.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ <h1>Tournament Ranking</h1>
<div class="col-md-1"></div>
<div class="teams col-md-11">
<table class="table table-striped">
<thead><tr><th>Teams</th><th>Score</th></tr></thead>
<thead>
<tr>
<th>Teams</th>
<th><a href="" ng-click="predicate = 'Score'; reverse=!reverse">Score</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="t in rankingData.Teams">
<tr ng-repeat="t in rankingData.Teams | orderBy:predicate:reverse">
<td><a href="/ng#/teams/{{t.Id}}">{{t.Name}}</a></td>
<td>{{t.Score}}</td>
</tr>
Expand All @@ -46,10 +51,15 @@ <h1>Tournament Ranking</h1>
<div class="col-md-1"></div>
<div class="participants col-md-11">
<table class="table table-striped">
<thead><tr><th>Participants</th><th>Score</th></tr></thead>
<thead>
<tr>
<th>Participants</th>
<th><a href="" ng-click="predicate = 'Score'; reverse=!reverse">Score</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="u in rankingData.Users">
<td><a href="/ng#/users/{{u.Id}}">{{u.Username}}</a></td>
<tr ng-repeat="u in rankingData.Users | orderBy:predicate:reverse">
<td><a href="/ng#/users/{{u.Id}}">{{u.Name}}</a></td>
<td>{{u.Score}}</td>
</tr>
</tbody>
Expand Down

0 comments on commit e4e9dbf

Please sign in to comment.