From: Ant Zucaro Date: Sat, 23 Jan 2016 15:40:50 +0000 (-0500) Subject: Make the rank index titles data-driven. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cb92f63bfc90877549fa7e7f5aba7f0aa4453b25;p=xonotic%2Fxonstat.git Make the rank index titles data-driven. --- diff --git a/xonstat/templates/rank_index.mako b/xonstat/templates/rank_index.mako index c6ea454..f1ad358 100644 --- a/xonstat/templates/rank_index.mako +++ b/xonstat/templates/rank_index.mako @@ -2,15 +2,7 @@ <%namespace file="navlinks.mako" import="navlinks" /> <%block name="title"> - % if game_type_cd == 'dm': - Deathmatch Rank Index - % elif game_type_cd == 'duel': - Duel Rank Index - % elif game_type_cd == 'tdm': - Team Deathmatch Rank Index - % elif game_type_cd == 'ctf': - Capture The Flag Rank Index - % endif + ${game_type.descr} Rank Index
diff --git a/xonstat/views/game.py b/xonstat/views/game.py index b8b739c..7af7c14 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -116,10 +116,7 @@ def game_info_json(request): def _rank_index_data(request): - if request.params.has_key('page'): - current_page = request.params['page'] - else: - current_page = 1 + current_page = request.params.get("page", 1) # game type whitelist game_types_allowed = ["ca", "ctf", "dm", "duel", "ft", "ka", "tdm"] @@ -132,6 +129,9 @@ def _rank_index_data(request): filter(PlayerRank.game_type_cd==game_type_cd).\ order_by(PlayerRank.rank) + game_type = DBSession.query(GameType).\ + filter(GameType.game_type_cd == game_type_cd).one() + ranks = Page(ranks_q, current_page, url=page_url) if len(ranks) == 0: @@ -140,6 +140,7 @@ def _rank_index_data(request): return { 'ranks':ranks, 'game_type_cd':game_type_cd, + 'game_type': game_type, }