From: Ant Zucaro <azucaro@gmail.com>
Date: Tue, 13 Nov 2012 00:59:37 +0000 (-0500)
Subject: Proper fix for big alivetimes.
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7074ae2d63ff7871a030fd89217696f9d8b71165;p=xonotic%2Fxonstat.git

Proper fix for big alivetimes.

Moral of the story: I should not code late at night.
---

diff --git a/xonstat/elo.py b/xonstat/elo.py
index 74c49cd..8293c97 100644
--- a/xonstat/elo.py
+++ b/xonstat/elo.py
@@ -66,13 +66,12 @@ def process_elos(game, session, game_type_cd=None):
                 # with a short circuit to handle alivetimes > game
                 # durations, which can happen due to warmup being
                 # included (most often in duels)
-                if game.duration is not None:
-                    if a.seconds > game.duration.seconds:
-                        scores[p] = s/float(game.duration.seconds)
+                if game.duration is not None and a.seconds > game.duration.seconds:
+                    scores[p] = s/float(game.duration.seconds)
+                    alivetimes[p] = game.duration.seconds
                 else:
                     scores[p] = s/float(a.seconds)
-
-                alivetimes[p] = a.seconds
+                    alivetimes[p] = a.seconds
 
     player_ids = scores.keys()