]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Store the active mods in the games table
authorAnt Zucaro <azucaro@gmail.com>
Tue, 5 Feb 2013 08:52:08 +0000 (03:52 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Tue, 5 Feb 2013 08:52:08 +0000 (03:52 -0500)
xonstat/views/submission.py

index 4541bdf6eb8125572ee554d531f56a049bca573a..b0d90518c5b190f0a1ad69d782a61eb07ee241c5 100644 (file)
@@ -446,9 +446,8 @@ def get_or_create_map(session=None, name=None):
     return gmap\r
 \r
 \r
-def create_game(session=None, start_dt=None, game_type_cd=None,\r
-        server_id=None, map_id=None, winner=None, match_id=None,\r
-        duration=None):\r
+def create_game(session, start_dt, game_type_cd, server_id, map_id,\r
+        match_id, duration, mod, winner=None):\r
     """\r
     Creates a game. Parameters:\r
 \r
@@ -458,12 +457,15 @@ def create_game(session=None, start_dt=None, game_type_cd=None,
     server_id - server identifier of the server hosting the game\r
     map_id - map on which the game was played\r
     winner - the team id of the team that won\r
+    duration - how long the game lasted\r
+    mod - mods in use during the game\r
     """\r
     seq = Sequence('games_game_id_seq')\r
     game_id = session.execute(seq)\r
     game = Game(game_id=game_id, start_dt=start_dt, game_type_cd=game_type_cd,\r
                 server_id=server_id, map_id=map_id, winner=winner)\r
     game.match_id = match_id\r
+    game.mod = mod[:64]\r
 \r
     try:\r
         game.duration = datetime.timedelta(seconds=int(round(float(duration))))\r
@@ -795,7 +797,8 @@ def submit_stats(request):
                 game_type_cd = game_type_cd,\r
                 map_id       = gmap.map_id,\r
                 match_id     = game_meta['I'],\r
-                duration     = duration)\r
+                duration     = duration,\r
+                mod          = game_meta.get('O', None))\r
 \r
         for events in raw_players:\r
             player = get_or_create_player(\r