From 8c160ea345e3f613214ad1e5f55abb91c7f09d6b Mon Sep 17 00:00:00 2001 From: antzucaro Date: Tue, 11 Oct 2011 18:18:09 -0400 Subject: [PATCH] Set the winner of the game according to which team the #1 ranked player belongs. --- xonstat/views/submission.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index 185907c..d8b0a1b 100755 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -235,6 +235,14 @@ def create_player_game_stat(session=None, player=None, pgstat.nick)) register_new_nick(session, player, pgstat.nick) + # if the player is ranked #1 and it is a team game, set the game's winner + # to be the team of that player + # FIXME: this is a hack, should be using the 'W' field (not present) + if pgstat.rank == '1' and pgstat.team: + log.debug('Found rank 1. Logging.') + game.winner = pgstat.team + session.add(game) + session.add(pgstat) session.flush() -- 2.39.2