From de9c8abb10785f0944ffbb066826e1338dfcf029 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Tue, 13 Nov 2012 23:02:56 -0500 Subject: [PATCH] Provide an option to show elo deltas on the game info page. I was tired of looking at the actual elo deltas by bouncing between the player_info and game_info pages for several players just to see their collective elo delta values. This provides a query parameter "show_elo" to the game info page to show the extra elo delta column. As a bonus, the up/down/neutral arrows on the player_info page will take you to a scoreboard page where those values are shown. --- xonstat/templates/game_info.mako | 2 +- xonstat/templates/player_info.mako | 20 +++++++++++--------- xonstat/templates/scoreboard.mako | 23 +++++++++++++++++++++-- xonstat/views/game.py | 8 ++++++++ 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/xonstat/templates/game_info.mako b/xonstat/templates/game_info.mako index 0e3a383..44d1f9c 100644 --- a/xonstat/templates/game_info.mako +++ b/xonstat/templates/game_info.mako @@ -42,7 +42,7 @@ Game Information

Scoreboard

- ${scoreboard(game.game_type_cd, pgstats)} + ${scoreboard(game.game_type_cd, pgstats, show_elo)}
diff --git a/xonstat/templates/player_info.mako b/xonstat/templates/player_info.mako index 2ae8709..4ad859b 100644 --- a/xonstat/templates/player_info.mako +++ b/xonstat/templates/player_info.mako @@ -457,17 +457,19 @@ Player Information ${game.fuzzy_date()} - % if gamestat.elo_delta is not None: - % if round(gamestat.elo_delta,2) > 0: - - % elif round(gamestat.elo_delta,2) < 0: - + + % if gamestat.elo_delta is not None: + % if round(gamestat.elo_delta,2) > 0: + + % elif round(gamestat.elo_delta,2) < 0: + + % else: + + % endif % else: - + % endif - % else: - - % endif + % endfor diff --git a/xonstat/templates/scoreboard.mako b/xonstat/templates/scoreboard.mako index 1ce98e8..5064bb1 100644 --- a/xonstat/templates/scoreboard.mako +++ b/xonstat/templates/scoreboard.mako @@ -1,4 +1,4 @@ -<%def name="scoreboard(game_type_cd, pgstats)"> +<%def name="scoreboard(game_type_cd, pgstats, show_elo=False)"> ${scoreboard_header(game_type_cd, pgstats[0])} @@ -19,8 +19,15 @@ ${scoreboard_header(game_type_cd, pgstats[0])} ${int(round(pgstat.avg_latency))} % endif - ${scoreboard_row(game_type_cd, pgstat)} + ${scoreboard_row(game_type_cd, pgstat)} + % if show_elo: + % if pgstat.elo_delta is not None: + + % else: + + % endif + % endif % endfor @@ -40,6 +47,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])} + % if show_elo: + + % endif % endif @@ -57,6 +67,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])} + % if show_elo: + + % endif % endif @@ -70,6 +83,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])} % endif + % if show_elo: + + % endif % endif @@ -85,6 +101,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])} + % if show_elo: + + % endif % endif diff --git a/xonstat/views/game.py b/xonstat/views/game.py index 2e088b8..f9389e0 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -55,6 +55,12 @@ def game_index_json(request): def _game_info_data(request): game_id = request.matchdict['id'] + + if request.params.has_key('show_elo'): + show_elo = True + else: + show_elo = False + try: notfound = False @@ -104,6 +110,7 @@ def _game_info_data(request): pgstats = None pwstats = None captimes = None + show_elo = False raise inst return {'game':game, @@ -112,6 +119,7 @@ def _game_info_data(request): 'pgstats':pgstats, 'pwstats':pwstats, 'captimes':captimes, + 'show_elo':show_elo, } -- 2.39.2
${pgstat.score}${round(pgstat.elo_delta,2)}-
Deaths Suicides ScoreElo Change
FCK Returns ScoreElo Change
Kills ScoreElo Change
Deaths Suicides ScoreElo Change