Fix imports.
authorAnt Zucaro <azucaro@gmail.com>
Mon, 7 Nov 2016 19:38:37 +0000 (14:38 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 7 Nov 2016 19:38:37 +0000 (14:38 -0500)
xonstat/elo.py
xonstat/views/submission.py

index 01a1e8a..bc0c332 100644 (file)
@@ -96,10 +96,12 @@ class EloProcessor:
 
         # used to determine if a pgstat record is elo-eligible
         def elo_eligible(pgs):
-            return pgs.player_id > 2 and pgs.alivetime > timedelta(seconds=0)
+            return pgs.player_id > 2 and pgs.alivetime > datetime.timedelta(seconds=0)
+
+        elostats = filter(elo_eligible, pgstats)
 
         # only process elos for elo-eligible players
-        for pgstat in filter(elo_eligible, pgstats):
+        for pgstat in elostats:
             self.wip[pgstat.player_id] = EloWIP(pgstat.player_id, pgstat)
 
         # determine duration from the maximum alivetime
index 74e2d3c..8e39017 100644 (file)
@@ -1,3 +1,4 @@
+import calendar
 import datetime
 import logging
 import re
@@ -958,7 +959,7 @@ def submit_stats(request):
         request.response.content_type = 'text/plain'
 
         return {
-                "now"        : timegm(datetime.datetime.utcnow().timetuple()),
+                "now"        : calendar.timegm(datetime.datetime.utcnow().timetuple()),
                 "server"     : server,
                 "game"       : game,
                 "gmap"       : gmap,