diff --git a/server.py b/server.py index fce5178..19c3d56 100644 --- a/server.py +++ b/server.py @@ -927,6 +927,11 @@ def get(self, region, id): return_dict['matches'] = match_list return_dict['wins'] = 0 return_dict['losses'] = 0 + + # current ranking period + return_dict['qualifying_matches'] = 0 + return_dict['qualifying_wins'] = 0 + return_dict['qualifying_losses'] = 0 if player.merged: # no need to look up tournaments for merged players @@ -958,17 +963,24 @@ def get(self, region, id): except: err('Invalid ObjectID') - if tournament.date >= (now - timedelta(day_limit)): + qualifying = tournament.date >= (now - timedelta(day_limit)) + + if qualifying: qualifying_tournaments.add(tournament.id) + return_dict['qualifying_matches'] += 1 if match.excluded is True: match_dict['result'] = 'excluded' elif match.did_player_win(player.id): match_dict['result'] = 'win' return_dict['wins'] += 1 + if qualifying: + return_dict['qualifying_wins'] += 1 else: match_dict['result'] = 'lose' return_dict['losses'] += 1 + if qualifying: + return_dict['qualifying_losses'] += 1 match_list.append(match_dict) diff --git a/webapp/app/head_to_head/controllers/headToHead.controller.js b/webapp/app/head_to_head/controllers/headToHead.controller.js index faabf18..48ccbde 100644 --- a/webapp/app/head_to_head/controllers/headToHead.controller.js +++ b/webapp/app/head_to_head/controllers/headToHead.controller.js @@ -6,6 +6,9 @@ angular.module('app.headToHead').controller("HeadToHeadController", function($sc $scope.player2 = null; $scope.wins = 0; $scope.losses = 0; + $scope.curMatches = 0; + $scope.curWins = 0; + $scope.curLosses = 0; // get fresh "player" from the change listener, since the model updates after the change listener is fired... $scope.onPlayer1Change = function(player) { @@ -28,6 +31,9 @@ angular.module('app.headToHead').controller("HeadToHeadController", function($sc $scope.matches = data.matches.reverse(); $scope.wins = data.wins; $scope.losses = data.losses; + $scope.curMatches = data.qualifying_matches; + $scope.curWins = data.qualifying_wins; + $scope.curLosses = data.qualifying_losses; }); } }; diff --git a/webapp/app/head_to_head/views/headtohead.html b/webapp/app/head_to_head/views/headtohead.html index 15b49ad..33162f9 100644 --- a/webapp/app/head_to_head/views/headtohead.html +++ b/webapp/app/head_to_head/views/headtohead.html @@ -5,37 +5,73 @@
+ Total +
++ This Period +
+| Date | Tournament | Winner | |||
|---|---|---|---|---|---|
| {{match.tournament_date}} | -{{match.tournament_name}} | -{{ determineMatchStatus(match,playerName,opponentName) }} | + +|||
| + {{match.tournament_date}} | ++ {{match.tournament_name}} | ++ {{ determineMatchStatus(match,playerName,opponentName) }} | + + ++ {{match.tournament_date}} | ++ {{match.tournament_name}} | ++ {{ determineMatchStatus(match,playerName,opponentName) }} | +