From 990496da7cede2fdfcbb12edfd4909216e7d3d0b Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Wed, 23 Jan 2013 07:13:27 -0500 Subject: [PATCH] Make latency displays parameter-driven. You can now use the show_latency query parameter to show ping information in the scoreboards on the game_info page. --- xonstat/templates/game_info.mako | 2 +- xonstat/templates/scoreboard.mako | 15 ++++++++------- xonstat/views/game.py | 7 +++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/xonstat/templates/game_info.mako b/xonstat/templates/game_info.mako index 678d612..12f8c23 100644 --- a/xonstat/templates/game_info.mako +++ b/xonstat/templates/game_info.mako @@ -49,7 +49,7 @@ Game Information

Scoreboard

- ${scoreboard(game.game_type_cd, pgstats, show_elo)} + ${scoreboard(game.game_type_cd, pgstats, show_elo, show_latency)}
diff --git a/xonstat/templates/scoreboard.mako b/xonstat/templates/scoreboard.mako index 3304a95..ae58fbd 100644 --- a/xonstat/templates/scoreboard.mako +++ b/xonstat/templates/scoreboard.mako @@ -1,6 +1,7 @@ -<%def name="scoreboard(game_type_cd, pgstats, show_elo=False)"> +<%def name="scoreboard(game_type_cd, pgstats, show_elo=False, show_latency=False)"> ${scoreboard_header(game_type_cd, pgstats[0])} +${show_latency} % for pgstat in pgstats: @@ -14,11 +15,11 @@ ${scoreboard_header(game_type_cd, pgstats[0])} ${pgstat.nick_html_colors()|n} % endif - % if pgstat.avg_latency is not None: + % if show_latency and pgstat.avg_latency is not None: - % else: + % elif show_latency: % endif ${scoreboard_row(game_type_cd, pgstat)} @@ -42,7 +43,7 @@ ${scoreboard_header(game_type_cd, pgstats[0])} - % if pgstat.avg_latency is not None: + % if show_latency: % endif @@ -60,7 +61,7 @@ ${scoreboard_header(game_type_cd, pgstats[0])} - % if pgstat.avg_latency is not None: + % if show_latency: % endif @@ -80,7 +81,7 @@ ${scoreboard_header(game_type_cd, pgstats[0])} - % if pgstat.avg_latency is not None: + % if show_latency: % endif @@ -96,7 +97,7 @@ ${scoreboard_header(game_type_cd, pgstats[0])} - % if pgstat.avg_latency is not None: + % if show_latency: % endif diff --git a/xonstat/views/game.py b/xonstat/views/game.py index 2a7fbb5..11be028 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -62,6 +62,11 @@ def _game_info_data(request): else: show_elo = False + if request.params.has_key('show_latency'): + show_latency = True + else: + show_latency = False + try: notfound = False @@ -112,6 +117,7 @@ def _game_info_data(request): pwstats = None captimes = None show_elo = False + show_latency = False raise inst return {'game':game, @@ -121,6 +127,7 @@ def _game_info_data(request): 'pwstats':pwstats, 'captimes':captimes, 'show_elo':show_elo, + 'show_latency':show_latency, } -- 2.39.2
${int(round(pgstat.avg_latency))}
NickPingKills
NickPingKills
NickPingKills
NickPingKills