3 import pyramid.httpexceptions
4 import sqlalchemy as sa
5 import sqlalchemy.sql.functions as func
6 from calendar import timegm
7 from collections import namedtuple
8 from webhelpers.paginate import Page
9 from xonstat.models import *
10 from xonstat.util import page_url, to_json, pretty_date, datetime_seconds
11 from xonstat.views.helpers import RecentGame, recent_games_q
13 log = logging.getLogger(__name__)
16 def player_index_data(request):
17 if request.params.has_key('page'):
18 current_page = request.params['page']
23 player_q = DBSession.query(Player).\
24 filter(Player.player_id > 2).\
25 filter(Player.active_ind == True).\
26 filter(sa.not_(Player.nick.like('Anonymous Player%'))).\
27 order_by(Player.player_id.desc())
29 players = Page(player_q, current_page, items_per_page=25, url=page_url)
31 except Exception as e:
35 return {'players':players
39 def player_index(request):
41 Provides a list of all the current players.
43 return player_index_data(request)
46 def player_index_json(request):
48 Provides a list of all the current players. JSON.
50 return [{'status':'not implemented'}]
53 def get_games_played(player_id):
55 Provides a breakdown by gametype of the games played by player_id.
57 Returns a list of namedtuples with the following members:
64 The list itself is ordered by the number of games played
66 GamesPlayed = namedtuple('GamesPlayed', ['game_type_cd', 'games', 'wins',
69 raw_games_played = DBSession.query('game_type_cd', 'wins', 'losses').\
71 "SELECT game_type_cd, "
74 "FROM (SELECT g.game_id, "
77 "WHEN g.winner = pgs.team THEN 1 "
78 "WHEN pgs.scoreboardpos = 1 THEN 1 "
82 "WHEN g.winner = pgs.team THEN 0 "
83 "WHEN pgs.scoreboardpos = 1 THEN 0 "
87 "player_game_stats pgs "
88 "WHERE g.game_id = pgs.game_id "
89 "AND pgs.player_id = :player_id) win_loss "
90 "GROUP BY game_type_cd "
91 ).params(player_id=player_id).all()
97 for row in raw_games_played:
98 games = row.wins + row.losses
99 overall_games += games
100 overall_wins += row.wins
101 overall_losses += row.losses
102 win_pct = float(row.wins)/games * 100
104 games_played.append(GamesPlayed(row.game_type_cd, games, row.wins,
105 row.losses, win_pct))
108 overall_win_pct = float(overall_wins)/overall_games * 100
110 overall_win_pct = 0.0
112 games_played.append(GamesPlayed('overall', overall_games, overall_wins,
113 overall_losses, overall_win_pct))
115 # sort the resulting list by # of games played
116 games_played = sorted(games_played, key=lambda x:x.games)
117 games_played.reverse()
121 def get_overall_stats(player_id):
123 Provides a breakdown of stats by gametype played by player_id.
125 Returns a dictionary of namedtuples with the following members:
129 - last_played (last time the player played the game type)
130 - last_played_epoch (same as above, but in seconds since epoch)
131 - last_played_fuzzy (same as above, but in relative date)
132 - total_playing_time (total amount of time played the game type)
133 - total_playing_time_secs (same as the above, but in seconds)
134 - total_pickups (ctf only)
135 - total_captures (ctf only)
136 - cap_ratio (ctf only)
137 - total_carrier_frags (ctf only)
141 The key to the dictionary is the game type code. There is also an
142 "overall" game_type_cd which sums the totals and computes the total ratios.
144 OverallStats = namedtuple('OverallStats', ['total_kills', 'total_deaths',
145 'k_d_ratio', 'last_played', 'last_played_epoch', 'last_played_fuzzy',
146 'total_playing_time', 'total_playing_time_secs', 'total_pickups', 'total_captures', 'cap_ratio',
147 'total_carrier_frags', 'game_type_cd', 'game_type_descr'])
149 raw_stats = DBSession.query('game_type_cd', 'game_type_descr',
150 'total_kills', 'total_deaths', 'last_played', 'total_playing_time',
151 'total_pickups', 'total_captures', 'total_carrier_frags').\
153 "SELECT g.game_type_cd, "
154 "gt.descr game_type_descr, "
155 "Sum(pgs.kills) total_kills, "
156 "Sum(pgs.deaths) total_deaths, "
157 "Max(pgs.create_dt) last_played, "
158 "Sum(pgs.alivetime) total_playing_time, "
159 "Sum(pgs.pickups) total_pickups, "
160 "Sum(pgs.captures) total_captures, "
161 "Sum(pgs.carrier_frags) total_carrier_frags "
164 "player_game_stats pgs "
165 "WHERE g.game_id = pgs.game_id "
166 "AND g.game_type_cd = gt.game_type_cd "
167 "AND pgs.player_id = :player_id "
168 "GROUP BY g.game_type_cd, game_type_descr "
170 "SELECT 'overall' game_type_cd, "
171 "'Overall' game_type_descr, "
172 "Sum(pgs.kills) total_kills, "
173 "Sum(pgs.deaths) total_deaths, "
174 "Max(pgs.create_dt) last_played, "
175 "Sum(pgs.alivetime) total_playing_time, "
176 "Sum(pgs.pickups) total_pickups, "
177 "Sum(pgs.captures) total_captures, "
178 "Sum(pgs.carrier_frags) total_carrier_frags "
179 "FROM player_game_stats pgs "
180 "WHERE pgs.player_id = :player_id "
181 ).params(player_id=player_id).all()
183 # to be indexed by game_type_cd
186 for row in raw_stats:
187 # individual gametype ratio calculations
189 k_d_ratio = float(row.total_kills)/row.total_deaths
194 cap_ratio = float(row.total_captures)/row.total_pickups
198 # everything else is untouched or "raw"
199 os = OverallStats(total_kills=row.total_kills,
200 total_deaths=row.total_deaths,
202 last_played=row.last_played,
203 last_played_epoch=timegm(row.last_played.timetuple()),
204 last_played_fuzzy=pretty_date(row.last_played),
205 total_playing_time=row.total_playing_time,
206 total_playing_time_secs=int(datetime_seconds(row.total_playing_time)),
207 total_pickups=row.total_pickups,
208 total_captures=row.total_captures,
210 total_carrier_frags=row.total_carrier_frags,
211 game_type_cd=row.game_type_cd,
212 game_type_descr=row.game_type_descr)
214 overall_stats[row.game_type_cd] = os
216 # We have to edit "overall" stats to exclude deaths in CTS.
217 # Although we still want to record deaths, they shouldn't
218 # count towards the overall K:D ratio.
219 if 'cts' in overall_stats:
220 os = overall_stats['overall']
223 k_d_ratio = float(os.total_kills)/(os.total_deaths - overall_stats['cts'].total_deaths)
227 non_cts_deaths = os.total_deaths - overall_stats['cts'].total_deaths
230 overall_stats['overall'] = OverallStats(
231 total_kills = os.total_kills,
232 total_deaths = non_cts_deaths,
233 k_d_ratio = k_d_ratio,
234 last_played = os.last_played,
235 last_played_epoch = os.last_played_epoch,
236 last_played_fuzzy = os.last_played_fuzzy,
237 total_playing_time = os.total_playing_time,
238 total_playing_time_secs = os.total_playing_time_secs,
239 total_pickups = os.total_pickups,
240 total_captures = os.total_captures,
241 cap_ratio = os.cap_ratio,
242 total_carrier_frags = os.total_carrier_frags,
243 game_type_cd = os.game_type_cd)
248 def get_fav_maps(player_id, game_type_cd=None):
250 Provides a breakdown of favorite maps by gametype.
252 Returns a dictionary of namedtuples with the following members:
254 - map_name (map name)
258 The favorite map is defined as the map you've played the most
259 for the given game_type_cd.
261 The key to the dictionary is the game type code. There is also an
262 "overall" game_type_cd which is the overall favorite map. This is
263 defined as the favorite map of the game type you've played the
264 most. The input parameter game_type_cd is for this.
266 FavMap = namedtuple('FavMap', ['map_name', 'map_id', 'times_played', 'game_type_cd'])
268 raw_favs = DBSession.query('game_type_cd', 'map_name',
269 'map_id', 'times_played').\
271 "SELECT game_type_cd, "
275 "FROM (SELECT g.game_type_cd, "
278 "Count(*) times_played, "
281 "partition BY g.game_type_cd "
282 "ORDER BY Count(*) DESC, m.map_id ASC) rank "
284 "player_game_stats pgs, "
286 "WHERE g.game_id = pgs.game_id "
287 "AND g.map_id = m.map_id "
288 "AND pgs.player_id = :player_id "
289 "GROUP BY g.game_type_cd, "
291 "m.name) most_played "
293 "ORDER BY times_played desc "
294 ).params(player_id=player_id).all()
299 fv = FavMap(map_name=row.map_name,
301 times_played=row.times_played,
302 game_type_cd=row.game_type_cd)
304 # if we aren't given a favorite game_type_cd
305 # then the overall favorite is the one we've
307 if overall_fav is None:
308 fav_maps['overall'] = fv
309 overall_fav = fv.game_type_cd
311 # otherwise it is the favorite map from the
312 # favorite game_type_cd (provided as a param)
313 # and we'll overwrite the first dict entry
314 if game_type_cd == fv.game_type_cd:
315 fav_maps['overall'] = fv
317 fav_maps[row.game_type_cd] = fv
322 def get_ranks(player_id):
324 Provides a breakdown of the player's ranks by game type.
326 Returns a dictionary of namedtuples with the following members:
331 The key to the dictionary is the game type code. There is also an
332 "overall" game_type_cd which is the overall best rank.
334 Rank = namedtuple('Rank', ['rank', 'max_rank', 'percentile', 'game_type_cd'])
336 raw_ranks = DBSession.query("game_type_cd", "rank", "max_rank").\
338 "select pr.game_type_cd, pr.rank, overall.max_rank "
339 "from player_ranks pr, "
340 "(select game_type_cd, max(rank) max_rank "
342 "group by game_type_cd) overall "
343 "where pr.game_type_cd = overall.game_type_cd "
344 "and player_id = :player_id "
346 params(player_id=player_id).all()
349 found_top_rank = False
350 for row in raw_ranks:
351 rank = Rank(rank=row.rank,
352 max_rank=row.max_rank,
353 percentile=100 - 100*float(row.rank-1)/(row.max_rank-1),
354 game_type_cd=row.game_type_cd)
357 if not found_top_rank:
358 ranks['overall'] = rank
359 found_top_rank = True
360 elif rank.percentile > ranks['overall'].percentile:
361 ranks['overall'] = rank
363 ranks[row.game_type_cd] = rank
368 def get_elos(player_id):
370 Provides a breakdown of the player's elos by game type.
372 Returns a dictionary of namedtuples with the following members:
378 The key to the dictionary is the game type code. There is also an
379 "overall" game_type_cd which is the overall best rank.
381 raw_elos = DBSession.query(PlayerElo).filter_by(player_id=player_id).\
382 order_by(PlayerElo.elo.desc()).all()
385 found_max_elo = False
387 if not found_max_elo:
388 elos['overall'] = row
391 elos[row.game_type_cd] = row
396 def get_recent_games(player_id):
398 Provides a list of recent games for a player. Uses the recent_games_q helper.
400 # recent games played in descending order
401 rgs = recent_games_q(player_id=player_id, force_player_id=True).limit(10).all()
402 recent_games = [RecentGame(row) for row in rgs]
407 def get_recent_weapons(player_id):
409 Returns the weapons that have been used in the past 90 days
410 and also used in 5 games or more.
412 cutoff = datetime.datetime.utcnow() - datetime.timedelta(days=90)
414 for weapon in DBSession.query(PlayerWeaponStat.weapon_cd, func.count()).\
415 filter(PlayerWeaponStat.player_id == player_id).\
416 filter(PlayerWeaponStat.create_dt > cutoff).\
417 group_by(PlayerWeaponStat.weapon_cd).\
418 having(func.count() > 4).\
420 recent_weapons.append(weapon[0])
422 return recent_weapons
425 def get_accuracy_stats(player_id, weapon_cd, games):
427 Provides accuracy for weapon_cd by player_id for the past N games.
429 # Reaching back 90 days should give us an accurate enough average
430 # We then multiply this out for the number of data points (games) to
431 # create parameters for a flot graph
433 raw_avg = DBSession.query(func.sum(PlayerWeaponStat.hit),
434 func.sum(PlayerWeaponStat.fired)).\
435 filter(PlayerWeaponStat.player_id == player_id).\
436 filter(PlayerWeaponStat.weapon_cd == weapon_cd).\
439 avg = round(float(raw_avg[0])/raw_avg[1]*100, 2)
441 # Determine the raw accuracy (hit, fired) numbers for $games games
442 # This is then enumerated to create parameters for a flot graph
443 raw_accs = DBSession.query(PlayerWeaponStat.game_id,
444 PlayerWeaponStat.hit, PlayerWeaponStat.fired).\
445 filter(PlayerWeaponStat.player_id == player_id).\
446 filter(PlayerWeaponStat.weapon_cd == weapon_cd).\
447 order_by(PlayerWeaponStat.game_id.desc()).\
451 # they come out in opposite order, so flip them in the right direction
455 for i in range(len(raw_accs)):
456 accs.append((raw_accs[i][0], round(float(raw_accs[i][1])/raw_accs[i][2]*100, 2)))
464 def get_damage_stats(player_id, weapon_cd, games):
466 Provides damage info for weapon_cd by player_id for the past N games.
469 raw_avg = DBSession.query(func.sum(PlayerWeaponStat.actual),
470 func.sum(PlayerWeaponStat.hit)).\
471 filter(PlayerWeaponStat.player_id == player_id).\
472 filter(PlayerWeaponStat.weapon_cd == weapon_cd).\
475 avg = round(float(raw_avg[0])/raw_avg[1], 2)
477 # Determine the damage efficiency (hit, fired) numbers for $games games
478 # This is then enumerated to create parameters for a flot graph
479 raw_dmgs = DBSession.query(PlayerWeaponStat.game_id,
480 PlayerWeaponStat.actual, PlayerWeaponStat.hit).\
481 filter(PlayerWeaponStat.player_id == player_id).\
482 filter(PlayerWeaponStat.weapon_cd == weapon_cd).\
483 order_by(PlayerWeaponStat.game_id.desc()).\
487 # they come out in opposite order, so flip them in the right direction
491 for i in range(len(raw_dmgs)):
492 # try to derive, unless we've hit nothing then set to 0!
494 dmg = round(float(raw_dmgs[i][1])/raw_dmgs[i][2], 2)
498 dmgs.append((raw_dmgs[i][0], dmg))
499 except Exception as e:
506 def player_info_data(request):
507 player_id = int(request.matchdict['id'])
512 player = DBSession.query(Player).filter_by(player_id=player_id).\
513 filter(Player.active_ind == True).one()
515 games_played = get_games_played(player_id)
516 overall_stats = get_overall_stats(player_id)
517 fav_maps = get_fav_maps(player_id)
518 elos = get_elos(player_id)
519 ranks = get_ranks(player_id)
520 recent_games = get_recent_games(player_id)
521 recent_weapons = get_recent_weapons(player_id)
523 except Exception as e:
532 ## do not raise exceptions here (only for debugging)
535 return {'player':player,
536 'games_played':games_played,
537 'overall_stats':overall_stats,
541 'recent_games':recent_games,
542 'recent_weapons':recent_weapons
546 def player_info(request):
548 Provides detailed information on a specific player
550 return player_info_data(request)
553 def player_info_json(request):
555 Provides detailed information on a specific player. JSON.
558 # All player_info fields are converted into JSON-formattable dictionaries
559 player_info = player_info_data(request)
561 player = player_info['player'].to_dict()
564 for game in player_info['games_played']:
565 games_played[game.game_type_cd] = to_json(game)
568 for gt,stats in player_info['overall_stats'].items():
569 overall_stats[gt] = to_json(stats)
572 for gt,elo in player_info['elos'].items():
573 elos[gt] = to_json(elo.to_dict())
576 for gt,rank in player_info['ranks'].items():
577 ranks[gt] = to_json(rank)
580 for gt,mapinfo in player_info['fav_maps'].items():
581 fav_maps[gt] = to_json(mapinfo)
584 for game in player_info['recent_games']:
585 recent_games.append(to_json(game))
587 #recent_weapons = player_info['recent_weapons']
591 'games_played': games_played,
592 'overall_stats': overall_stats,
593 'fav_maps': fav_maps,
596 'recent_games': recent_games,
597 # 'recent_weapons': recent_weapons,
598 'recent_weapons': ['not implemented'],
600 #return [{'status':'not implemented'}]
603 def player_game_index_data(request):
604 player_id = request.matchdict['player_id']
607 game_type_descr = None
609 if request.params.has_key('type'):
610 game_type_cd = request.params['type']
612 game_type_descr = DBSession.query(GameType.descr).\
613 filter(GameType.game_type_cd == game_type_cd).\
615 except Exception as e:
620 game_type_descr = None
622 if request.params.has_key('page'):
623 current_page = request.params['page']
628 player = DBSession.query(Player).\
629 filter_by(player_id=player_id).\
630 filter(Player.active_ind == True).\
633 rgs_q = recent_games_q(player_id=player.player_id,
634 force_player_id=True, game_type_cd=game_type_cd)
636 games = Page(rgs_q, current_page, items_per_page=10, url=page_url)
638 # replace the items in the canned pagination class with more rich ones
639 games.items = [RecentGame(row) for row in games.items]
641 games_played = get_games_played(player_id)
643 except Exception as e:
647 game_type_descr = None
651 'player_id':player.player_id,
654 'game_type_cd':game_type_cd,
655 'game_type_descr':game_type_descr,
656 'games_played':games_played,
660 def player_game_index(request):
662 Provides an index of the games in which a particular
663 player was involved. This is ordered by game_id, with
664 the most recent game_ids first. Paginated.
666 return player_game_index_data(request)
669 def player_game_index_json(request):
671 Provides an index of the games in which a particular
672 player was involved. This is ordered by game_id, with
673 the most recent game_ids first. Paginated. JSON.
675 return [{'status':'not implemented'}]
678 def player_accuracy_data(request):
679 player_id = request.matchdict['id']
680 allowed_weapons = ['nex', 'rifle', 'shotgun', 'uzi', 'minstanex']
684 if request.params.has_key('weapon'):
685 if request.params['weapon'] in allowed_weapons:
686 weapon_cd = request.params['weapon']
688 if request.params.has_key('games'):
690 games = request.params['games']
699 (avg, accs) = get_accuracy_stats(player_id, weapon_cd, games)
701 # if we don't have enough data for the given weapon
702 if len(accs) < games:
706 'player_id':player_id,
707 'player_url':request.route_url('player_info', id=player_id),
715 def player_accuracy(request):
717 Provides the accuracy for the given weapon. (JSON only)
719 return player_accuracy_data(request)
722 def player_accuracy_json(request):
724 Provides a JSON response representing the accuracy for the given weapon.
727 weapon = which weapon to display accuracy for. Valid values are 'nex',
728 'shotgun', 'uzi', and 'minstanex'.
729 games = over how many games to display accuracy. Can be up to 50.
731 return player_accuracy_data(request)
734 def player_damage_data(request):
735 player_id = request.matchdict['id']
736 allowed_weapons = ['grenadelauncher', 'electro', 'crylink', 'hagar',
737 'rocketlauncher', 'laser']
738 weapon_cd = 'rocketlauncher'
741 if request.params.has_key('weapon'):
742 if request.params['weapon'] in allowed_weapons:
743 weapon_cd = request.params['weapon']
745 if request.params.has_key('games'):
747 games = request.params['games']
756 (avg, dmgs) = get_damage_stats(player_id, weapon_cd, games)
758 # if we don't have enough data for the given weapon
759 if len(dmgs) < games:
763 'player_id':player_id,
764 'player_url':request.route_url('player_info', id=player_id),
772 def player_damage_json(request):
774 Provides a JSON response representing the damage for the given weapon.
777 weapon = which weapon to display damage for. Valid values are
778 'grenadelauncher', 'electro', 'crylink', 'hagar', 'rocketlauncher',
780 games = over how many games to display damage. Can be up to 50.
782 return player_damage_data(request)
785 def player_hashkey_info_data(request):
786 hashkey = request.matchdict['hashkey']
788 player = DBSession.query(Player).\
789 filter(Player.player_id == Hashkey.player_id).\
790 filter(Player.active_ind == True).\
791 filter(Hashkey.hashkey == hashkey).one()
793 games_played = get_games_played(player.player_id)
794 overall_stats = get_overall_stats(player.player_id)
795 fav_maps = get_fav_maps(player.player_id)
796 elos = get_elos(player.player_id)
797 ranks = get_ranks(player.player_id)
799 except Exception as e:
800 raise pyramid.httpexceptions.HTTPNotFound
802 return {'player':player,
804 'games_played':games_played,
805 'overall_stats':overall_stats,
812 def player_hashkey_info_json(request):
814 Provides detailed information on a specific player. JSON.
817 # All player_info fields are converted into JSON-formattable dictionaries
818 player_info = player_hashkey_info_data(request)
820 player = player_info['player'].to_dict()
823 for game in player_info['games_played']:
824 games_played[game.game_type_cd] = to_json(game)
827 for gt,stats in player_info['overall_stats'].items():
828 overall_stats[gt] = to_json(stats)
831 for gt,elo in player_info['elos'].items():
832 elos[gt] = to_json(elo.to_dict())
835 for gt,rank in player_info['ranks'].items():
836 ranks[gt] = to_json(rank)
839 for gt,mapinfo in player_info['fav_maps'].items():
840 fav_maps[gt] = to_json(mapinfo)
845 'games_played': games_played,
846 'overall_stats': overall_stats,
847 'fav_maps': fav_maps,
853 def player_hashkey_info_text(request):
855 Provides detailed information on a specific player. Plain text.
858 now = timegm(datetime.datetime.utcnow().timetuple())
860 # All player_info fields are converted into JSON-formattable dictionaries
861 player_info = player_hashkey_info_data(request)
863 # gather all of the data up into aggregate structures
864 player = player_info['player']
865 games_played = player_info['games_played']
866 overall_stats = player_info['overall_stats']
867 elos = player_info['elos']
868 ranks = player_info['ranks']
869 fav_maps = player_info['fav_maps']
871 # one-offs for things needing conversion for text/plain
872 player_joined = timegm(player.create_dt.timetuple())
873 alivetime = int(datetime_seconds(overall_stats['overall'].total_playing_time))
875 # this is a plain text response, if we don't do this here then
876 # Pyramid will assume html
877 request.response.content_type = 'text/plain'
883 'hashkey': player_info['hashkey'],
884 'player_joined': player_joined,
885 'games_played': games_played,
886 'overall_stats': overall_stats,
887 'alivetime': alivetime,
888 'fav_maps': fav_maps,
894 def player_elo_info_data(request):
896 Provides elo information on a specific player. Raw data is returned.
898 hashkey = request.matchdict['hashkey']
900 player = DBSession.query(Player).\
901 filter(Player.player_id == Hashkey.player_id).\
902 filter(Player.active_ind == True).\
903 filter(Hashkey.hashkey == hashkey).one()
905 elos = get_elos(player.player_id)
907 except Exception as e:
909 raise pyramid.httpexceptions.HTTPNotFound
914 def player_elo_info_json(request):
916 Provides elo information on a specific player. JSON.
918 elo_info = player_elo_info_data(request)
921 for gt, elo in elo_info['elos'].items():
922 elos[gt] = to_json(elo.to_dict())
929 def player_captimes_data(request):
930 player_id = int(request.matchdict['id'])
934 PlayerCaptimes = namedtuple('PlayerCaptimes', ['fastest_cap', 'create_dt', 'create_dt_epoch', 'create_dt_fuzzy',
935 'player_id', 'game_id', 'map_id', 'map_name', 'server_id', 'server_name'])
937 dbquery = DBSession.query('fastest_cap', 'create_dt', 'player_id', 'game_id', 'map_id',
938 'map_name', 'server_id', 'server_name').\
940 "SELECT ct.fastest_cap, "
947 "s.name server_name "
948 "FROM player_map_captimes ct, "
952 "WHERE ct.player_id = :player_id "
953 "AND g.game_id = ct.game_id "
954 "AND g.server_id = s.server_id "
955 "AND m.map_id = ct.map_id "
956 #"ORDER BY ct.fastest_cap "
957 "ORDER BY ct.create_dt desc"
958 ).params(player_id=player_id).all()
960 player = DBSession.query(Player).filter_by(player_id=player_id).one()
964 player_captimes.append(PlayerCaptimes(
965 fastest_cap=row.fastest_cap,
966 create_dt=row.create_dt,
967 create_dt_epoch=timegm(row.create_dt.timetuple()),
968 create_dt_fuzzy=pretty_date(row.create_dt),
969 player_id=row.player_id,
972 map_name=row.map_name,
973 server_id=row.server_id,
974 server_name=row.server_name,
978 'captimes':player_captimes,
979 'player_id':player_id,
980 'player_url':request.route_url('player_info', id=player_id),
984 def player_captimes(request):
985 return player_captimes_data(request)
987 def player_captimes_json(request):
988 return player_captimes_data(request)