From 66d8d835cbcd19bec63f36363fda9ce9497ddaf6 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 22 Feb 2015 16:27:11 -0500 Subject: [PATCH] Specify recent games by starting or ending game_id. --- xonstat/views/helpers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xonstat/views/helpers.py b/xonstat/views/helpers.py index f8853a2..7172279 100644 --- a/xonstat/views/helpers.py +++ b/xonstat/views/helpers.py @@ -77,7 +77,8 @@ class RecentGame(object): def recent_games_q(server_id=None, map_id=None, player_id=None, - game_type_cd=None, cutoff=None, force_player_id=False): + game_type_cd=None, cutoff=None, force_player_id=False, + start_game_id=None, end_game_id=None): ''' Returns a SQLA query of recent game data. Parameters filter the results returned if they are provided. If not, it is @@ -137,4 +138,10 @@ def recent_games_q(server_id=None, map_id=None, player_id=None, recent_games_q = recent_games_q.\ filter(expr.between(Game.create_dt, cutoff, right_now)) + if start_game_id is not None: + recent_games_q = recent_games_q.filter(Game.game_id <= start_game_id) + + if end_game_id is not None: + recent_games_q = recent_games_q.filter(Game.game_id >= end_game_id) + return recent_games_q -- 2.39.2