From a3c349734c02b744e8f7d39ec09b222d85081d10 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 24 Dec 2017 09:02:35 -0500 Subject: [PATCH] Use total_seconds() for timedeltas. --- xonstat/glicko.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xonstat/glicko.py b/xonstat/glicko.py index 2c0b5e0..6d185fb 100644 --- a/xonstat/glicko.py +++ b/xonstat/glicko.py @@ -251,7 +251,7 @@ class GlickoProcessor(object): pgstat.alivetime = game.duration # ensure players played enough of the match to be included - k = KREDUCTION.eval(pgstat.alivetime.seconds, game.duration.seconds) + k = KREDUCTION.eval(pgstat.alivetime.total_seconds(), game.duration.total_seconds()) if k <= 0.0: continue else: @@ -303,8 +303,9 @@ class GlickoProcessor(object): # pi/j => ping ratio for player i/j for i in xrange(0, len(pgstats)): wipi = self._load_glicko_wip(pgstats[i].player_id, game_type_cd, category) - ki = KREDUCTION.eval(pgstats[i].alivetime.seconds, game.duration.seconds) - si = pgstats[i].score/float(game.duration.seconds) + ki = KREDUCTION.eval(pgstats[i].alivetime.total_seconds(), + game.duration.total_seconds()) + si = pgstats[i].score/float(game.duration.total_seconds()) for j in xrange(i+1, len(pgstats)): # ping factor is opponent-specific @@ -312,7 +313,8 @@ class GlickoProcessor(object): pj = 1.0 - pi wipj = self._load_glicko_wip(pgstats[j].player_id, game_type_cd, category) - kj = KREDUCTION.eval(pgstats[j].alivetime.seconds, game.duration.seconds) + kj = KREDUCTION.eval(pgstats[j].alivetime.total_seconds(), + game.duration.total_seconds()) sj = pgstats[j].score/float(game.duration.seconds) # normalize scores -- 2.39.2