]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add most recent game to JSON view too.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 18 Aug 2013 19:06:11 +0000 (15:06 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 18 Aug 2013 19:06:11 +0000 (15:06 -0400)
xonstat/__init__.py
xonstat/views/player.py

index bfe2a9fd7eeef24c2261831393e1df5a80e01d97..b60c35bced012e5b58156c0d1f1d7767e423fb66 100644 (file)
@@ -48,6 +48,9 @@ def main(global_config, **settings):
     config.add_route("player_info",      "/player/{id:\d+}")
     config.add_view(player_info,      route_name="player_info",      renderer="player_info.mako")
 
+    config.add_route("player_hashkey_info_json", "/player/{hashkey:.{44}}.json")
+    config.add_view(player_hashkey_info_json, route_name="player_hashkey_info_json", renderer="jsonp")
+
     #config.add_route("player_hashkey_info_text", "/player/me")
     config.add_route("player_hashkey_info_text", "/player/{hashkey}")
     config.add_view(player_hashkey_info_text, route_name="player_hashkey_info_text", renderer="player_hashkey_info_text.mako")
index 575373b36ec0cfb1c92a1f555c22b73b4be17dc4..a1945cc80791ea609970264e6c57c00a9e866f04 100644 (file)
@@ -852,6 +852,8 @@ def player_hashkey_info_json(request):
     for gt,mapinfo in player_info['fav_maps'].items():
         fav_maps[gt] = to_json(mapinfo)
 
+    most_recent_game = to_json(player_info['most_recent_game'])
+
     return [{
         'version':          1,
         'player':           player,
@@ -860,6 +862,7 @@ def player_hashkey_info_json(request):
         'fav_maps':         fav_maps,
         'elos':             elos,
         'ranks':            ranks,
+        'most_recent_game': most_recent_game,
     }]