]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Updating player hashkey view
authorJan Behrens <zykure@web.de>
Sun, 18 Aug 2013 14:20:26 +0000 (16:20 +0200)
committerJan Behrens <zykure@web.de>
Sun, 18 Aug 2013 14:20:26 +0000 (16:20 +0200)
xonstat/__init__.py
xonstat/templates/player_hashkey_info_text.mako
xonstat/views/player.py

index 49493d8cfb53bc5dda2406da3be9598b92c59ad7..0433461732e1160bda14af816e568f164bb600ce 100644 (file)
@@ -45,7 +45,8 @@ def main(global_config, **settings):
     config.add_route("player_game_index_json", "/player/{player_id:\d+}/games.json")
     config.add_view(player_game_index_json, route_name="player_game_index_json", renderer="jsonp")
 
-    config.add_route("player_hashkey_info_text", "/player/me")
+    #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")
 
     config.add_route("player_info",      "/player/{id:\d+}")
index cea9643603d09d580fd6647d3d0c1bbd7f54e6a1..7b5f2ba671c845d766882dcb70787cf2db6bfe12 100644 (file)
@@ -6,6 +6,7 @@ P ${hashkey}
 n ${player.nick}
 i ${player.player_id}
 e joined ${player_joined}
+e joined_dt ${player_joined_dt}
 % if player.active_ind == True:
 e active-ind 1
 % else:
index 824b980e242369541cc9aec2c897bd849a043146..87967b9e3d23e04deeb8c5d0ec697f45784b7329 100644 (file)
@@ -791,13 +791,15 @@ def player_hashkey_info_data(request):
     (idfp, status) = verify_request(request)
     print "player_hashkey_info_data [idfp={0} status={1}]".format(idfp, status)
 
+    hashkey = request.matchdict['hashkey']
+
     # if config is to *not* verify requests and we get nothing back, this
     # query will return nothing and we'll 404.
     try:
         player = DBSession.query(Player).\
                 filter(Player.player_id == Hashkey.player_id).\
                 filter(Player.active_ind == True).\
-                filter(Hashkey.hashkey == idfp).one()
+                filter(Hashkey.hashkey == hashkey).one()
 
         games_played   = get_games_played(player.player_id)
         overall_stats  = get_overall_stats(player.player_id)
@@ -879,6 +881,7 @@ def player_hashkey_info_text(request):
 
     # one-offs for things needing conversion for text/plain
     player_joined = timegm(player.create_dt.timetuple())
+    player_joined_dt = player.create_dt.strftime('%Y-%m-%d %H:%M:%SZ')
     alivetime = int(datetime_seconds(overall_stats['overall'].total_playing_time))
 
     # this is a plain text response, if we don't do this here then
@@ -891,6 +894,7 @@ def player_hashkey_info_text(request):
         'player':           player,
         'hashkey':          player_info['hashkey'],
         'player_joined':    player_joined,
+        'player_joined_dt': player_joined_dt,
         'games_played':     games_played,
         'overall_stats':    overall_stats,
         'alivetime':        alivetime,