]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/elo.py
Make search results look more like the index pages.
[xonotic/xonstat.git] / xonstat / elo.py
index 74c49cd589137f6e4e15c974bff65238512368a2..60da5311a15c3bad02a90df3e625979ac9278733 100644 (file)
@@ -1,3 +1,4 @@
+import datetime
 import logging
 import math
 import random
@@ -66,13 +67,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()
 
@@ -186,6 +186,7 @@ def update_elos(game, session, elos, scores, ep):
 
         elos[pid].elo = new_elo
         elos[pid].games += 1
+        elos[pid].update_dt = datetime.datetime.utcnow()
 
         log.debug("Setting Player {0}'s Elo delta to {1}. Elo is now {2} (was {3}).".format(pid, elo_deltas[pid], new_elo, old_elo))