From a268278287fda50f9f62e8fa60c879e414d9dfef Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 18 Aug 2013 15:06:11 -0400 Subject: [PATCH] Add most recent game to JSON view too. --- xonstat/__init__.py | 3 +++ xonstat/views/player.py | 3 +++ 2 files changed, 6 insertions(+) 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, }] -- 2.39.2