]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add a 'category' attribute to PlayerElo.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 29 Apr 2017 14:46:59 +0000 (10:46 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 29 Apr 2017 14:46:59 +0000 (10:46 -0400)
xonstat/models/player.py

index d9df0759d628a8d3bbb06a30dfcc9fa745e442f6..2fcf58ff22b3fd763d94e1368c5677b5902bb9aa 100644 (file)
@@ -103,21 +103,23 @@ class PlayerElo(object):
     A player's skill for a particular game type, as determined by a modified Elo algorithm.
     """
 
-    def __init__(self, player_id=None, game_type_cd=None, elo=None):
+    def __init__(self, player_id=None, game_type_cd=None, elo=None, category="general"):
         self.player_id = player_id
         self.game_type_cd = game_type_cd
         self.elo = elo
         self.score = 0
         self.games = 0
+        self.category = category
 
     def __repr__(self):
-        return ("<PlayerElo(pid={0.player_id}, gametype={0.game_type_cd}, elo={0.elo}, "
-                "games={0.games})>".format(self))
+        return ("<PlayerElo(pid={0.player_id}, gametype={0.game_type_cd}, category={0.category}, "
+                "elo={0.elo}, games={0.games})>".format(self))
 
     def to_dict(self):
         return {
             'player_id': self.player_id,
             'game_type_cd': self.game_type_cd,
+            'category': self.category,
             'elo': self.elo,
             'games': self.games,
         }