]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Specify recent games by starting or ending game_id.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 22 Feb 2015 21:27:11 +0000 (16:27 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 22 Feb 2015 21:27:11 +0000 (16:27 -0500)
xonstat/views/helpers.py

index f8853a22463cc6a76236822dee4902f990b4fdd2..7172279203065589f8bce300bb3f618fead95838 100644 (file)
@@ -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