]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Set the winner of the game according to which team the #1 ranked player belongs.
authorantzucaro <azucaro@gmail.com>
Tue, 11 Oct 2011 22:18:09 +0000 (18:18 -0400)
committerantzucaro <azucaro@gmail.com>
Tue, 11 Oct 2011 22:18:09 +0000 (18:18 -0400)
xonstat/views/submission.py

index 185907ca88b81c117a83cdbfe864e780b1e7ef35..d8b0a1b292b33dbb1c69f127f4837b9af16375e2 100755 (executable)
@@ -235,6 +235,14 @@ def create_player_game_stat(session=None, player=None,
             pgstat.nick))\r
         register_new_nick(session, player, pgstat.nick)\r
 \r
+    # if the player is ranked #1 and it is a team game, set the game's winner\r
+    # to be the team of that player\r
+    # FIXME: this is a hack, should be using the 'W' field (not present)\r
+    if pgstat.rank == '1' and pgstat.team:\r
+        log.debug('Found rank 1. Logging.')\r
+        game.winner = pgstat.team\r
+        session.add(game)\r
+\r
     session.add(pgstat)\r
     session.flush()\r
 \r