]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Fix the player JSON view with a _asdict() method to RecentGame-s.
authorAnt Zucaro <azucaro@gmail.com>
Fri, 21 Dec 2012 22:38:53 +0000 (17:38 -0500)
committerJan Behrens <zykure@web.de>
Sun, 23 Dec 2012 14:18:35 +0000 (15:18 +0100)
xonstat/views/helpers.py

index 1ae835020c40b2c99bea55ee928ba4ffdb421981..1affe0dc6df0f9b50e560245c77ee711329def4b 100644 (file)
@@ -48,6 +48,26 @@ class RecentGame(object):
         except:
             self.elo_delta = None
 
+    def _asdict(self):
+        return {
+            "game_id": self.game_id,
+            "game_type_cd": self.game_type_cd,
+            "winner": self.winner,
+            "start_dt": self.start_dt,
+            "fuzzy_dt": self.fuzzy_date,
+            "epoch": self.epoch,
+            "server_id": self.server_id,
+            "server_name": self.server_name,
+            "map_id": self.map_id,
+            "map_name": self.map_name,
+            "player_id": self.player_id,
+            "nick": self.nick,
+            "nick_html_colors": self.nick_html_colors,
+            "rank": self.rank,
+            "team": self.team,
+            "elo_delta": self.elo_delta,
+            }
+
 
 def recent_games_q(server_id=None, map_id=None, player_id=None, cutoff=None):
     '''