From: Ant Zucaro Date: Sun, 18 Aug 2013 19:06:11 +0000 (-0400) Subject: Add most recent game to JSON view too. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a268278287fda50f9f62e8fa60c879e414d9dfef;p=xonotic%2Fxonstat.git Add most recent game to JSON view too. --- diff --git a/xonstat/__init__.py b/xonstat/__init__.py index bfe2a9f..b60c35b 100644 --- a/xonstat/__init__.py +++ b/xonstat/__init__.py @@ -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") diff --git a/xonstat/views/player.py b/xonstat/views/player.py index 575373b..a1945cc 100644 --- a/xonstat/views/player.py +++ b/xonstat/views/player.py @@ -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, }]