From: Ant Zucaro Date: Sun, 22 Feb 2015 21:27:11 +0000 (-0500) Subject: Specify recent games by starting or ending game_id. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=66d8d835cbcd19bec63f36363fda9ce9497ddaf6;p=xonotic%2Fxonstat.git Specify recent games by starting or ending game_id. --- 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