]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Show latency in game_info if at least one player has a value.
authorAnt Zucaro <azucaro@gmail.com>
Wed, 24 Jul 2013 01:21:05 +0000 (21:21 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 24 Jul 2013 01:21:05 +0000 (21:21 -0400)
xonstat/static/css/app.css
xonstat/static/css/app.min.css
xonstat/templates/scoreboard.mako
xonstat/views/game.py

index 6561efb1954613507219dc775dc08dc84d5ee7e1..fedf997b889c115c6d96dc8248088d15995b70bb 100644 (file)
@@ -201,6 +201,7 @@ table td {
   color: #ad00ad;
 }
 .player-score { color: #FEFF3A; }
+.ping { width: 50px; }
 
 /* accuracy and weapon graphs */
 .weapon-nav {
index f4c84c7be777a0613e5ef3abcd917289af48edbb..b41835bcc3e909f02093584cf585e23d287f4c14 100644 (file)
@@ -1 +1 @@
-@font-face{font-family:'XoloniumNormal';src:url('fonts/xolonium-webfont.eot');src:url('fonts/xolonium-webfont.eot?#iefix') format('embedded-opentype'),url('fonts/xolonium-webfont.woff') format('woff'),url('fonts/xolonium-webfont.ttf') format('truetype'),url('fonts/xolonium-webfont.svg#XoloniumNormal') format('svg');font-weight:normal;font-style:normal}body{background:url("img/web_background_4.jpg") no-repeat fixed center center / cover black;background-color:black;color:#d0d0d0;font-family:"XoloniumNormal","Helvetica Neue",Helvetica,Arial,sans-serif}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999}h1{font-size:30px;line-height:36px}h1 small{font-size:18px}h2{font-size:24px;line-height:36px}h2 small{font-size:18px}h3{line-height:27px;font-size:18px}h3 small{font-size:14px}h4,h5,h6{line-height:18px}h4{font-size:14px}h4 small{font-size:12px}h5{font-size:12px}h6{font-size:11px;color:#999;text-transform:uppercase}table{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.7);border:1px solid #436688}table th{border:1px solid #436688;background-color:#001021}table td{border:1px solid #436688;font-size:10px}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#222}.table th,.table td{border:1px solid #436688}.table td{vertical-align:middle}.table .tdcenter{text-align:center}.accordion-group{border:1px solid #272525}.accordion-inner{border:0}#statline{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;position:relative;top:-25px}#xonborder{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.5);border-radius:15px 15px 15px 15px;margin-bottom:30px;margin-left:0;padding:20px}#title{color:#08c;font-size:30px;margin-bottom:15px;position:relative;text-align:center;text-shadow:2px 2px 3px #333}.indexform{margin:20px 0 20px 0}.indexbox{width:250px}.navbar-brand{margin-left:0;padding-bottom:0;padding-top:10px;text-align:left}.navbar-inverse{background:none repeat scroll 0 0 rgba(0,0,0,0.6)}.navbar-inverse .nav>.active>a,.navbar-inverse .nav>.active>a:hover,.navbar-inverse .nav>.active>a:focus{background:none repeat scroll 0 0 rgba(49,49,49,0.6)}.navbar-inverse .nav>li>a,.navbar-brand{font-family:XoloniumNormal}.search,input[type="search"]{background-color:#606060;border:1px solid #202020;color:#aaa;width:100px}.game{float:left;min-width:700px;padding:10px 7px}.game a{color:#CCC}.game a:hover{color:#d95f00;text-decoration:none}.game tr{background-color:#000}.game tr.red{background-color:#4d0000}.game tr.blue{background-color:#00004d}.game tr.yellow{background-color:#4d4d00}.game tr.pink{background-color:#4d004d}.game tr:hover{background-color:#222}.teamscore{text-align:right;text-shadow:-1px -1px 0 #222;font-size:200%;font-weight:bold;padding:10px 7px;margin-right:10px;margin-top:20px}.teamscore .red{color:#ad0000}.teamscore .blue{color:#0000ad}.teamscore .yellow{color:#adad00}.teamscore .pink{color:#ad00ad}.player-score{color:#feff3a}.weapon-nav{height:70px;margin-bottom:20px}.weapon-nav ul{display:block;list-style:none outside none}.weapon-nav li{cursor:pointer;float:left;margin-right:10px}.weapon-nav li:hover{border-bottom:2px solid #001021}.weapon-nav .weapon-active{border-bottom:2px solid #436688}.weapon-nav p{text-align:center}.flot table,.flot td{background-color:black;border:0}#gbtabcontainer{margin-top:10px}#gbtab{font-size:12px}.tabbable p{font-size:14px}.tabs-below .nav-tabs>li>a{border-radius:4px 4px 4px 4px}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>.active>a,.nav-tabs>.active>a:focus{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>li>a{border-radius:4px 4px 4px 4px;text-align:center}.nav-tabs>li>a:hover{background-color:#111;border-color:#333}.nav-tabs{border-bottom:0 solid #000}.table .tdcenter{text-align:center}.game-detail img{float:left;margin-right:10px;margin-bottom:5px}.game img{float:left;margin-right:5px;margin-bottom:5px}.game-detail p,.game h4{float:left}.teamscores tr{background-color:#000}.teamscores td{padding:3px;text-align:center;font-size:12px;font-weight:bold}.teamscores tr.red{background-color:#4d0000}.teamscores tr.blue{background-color:#00004d}.teamscores tr.yellow{background-color:#4d4d00}.teamscores tr.pink{background-color:#4d004d}.btn-toolbar .nav>li a{width:80px}.btn.dropdown-toggle,.btn.dropdown-toggle:active{background:0;border:1px solid transparent;border-radius:4px 4px 4px 4px;line-height:20px;color:#428bca;padding:10px 0 10px 0;font-size:14px;outline:0}.btn.dropdown-toggle:hover,.btn.dropdown-toggle:focus{background-color:#111;color:#2a6496;border-color:#333}.btn.dropdown-toggle>.caret{height:21px;border-top-color:#428bca;border-top-width:8px;border-left-width:8px;border-right-width:8px}.dropdown-menu{width:100px}.dropdown-menu.nav-tabs{padding:4px;background-color:#111;border:1px solid #333;width:256px}.dropdown-menu.nav-tabs>li>a{width:80px;color:inherit}.dropdown-menu.nav-tabs>li>a:hover{color:#222}.nostretch{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.player-nick{width:25%}.eloup{color:green}.elodown{color:#be0000}.eloneutral{color:gray}.pagination>li>a,.pagination>li>span{background-color:#111;border-color:#313131;color:#797979}.pagination>li>a:hover,.pagination>li>a:focus,.pagination>.active>a,.pagination>.active>span{background-color:#2b2222}@media(min-width:768px){.navbar-form{float:right}}
\ No newline at end of file
+@font-face{font-family:'XoloniumNormal';src:url('fonts/xolonium-webfont.eot');src:url('fonts/xolonium-webfont.eot?#iefix') format('embedded-opentype'),url('fonts/xolonium-webfont.woff') format('woff'),url('fonts/xolonium-webfont.ttf') format('truetype'),url('fonts/xolonium-webfont.svg#XoloniumNormal') format('svg');font-weight:normal;font-style:normal}body{background:url("img/web_background_4.jpg") no-repeat fixed center center / cover black;background-color:black;color:#d0d0d0;font-family:"XoloniumNormal","Helvetica Neue",Helvetica,Arial,sans-serif}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999}h1{font-size:30px;line-height:36px}h1 small{font-size:18px}h2{font-size:24px;line-height:36px}h2 small{font-size:18px}h3{line-height:27px;font-size:18px}h3 small{font-size:14px}h4,h5,h6{line-height:18px}h4{font-size:14px}h4 small{font-size:12px}h5{font-size:12px}h6{font-size:11px;color:#999;text-transform:uppercase}table{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.7);border:1px solid #436688}table th{border:1px solid #436688;background-color:#001021}table td{border:1px solid #436688;font-size:10px}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#222}.table th,.table td{border:1px solid #436688}.table td{vertical-align:middle}.table .tdcenter{text-align:center}.accordion-group{border:1px solid #272525}.accordion-inner{border:0}#statline{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;position:relative;top:-25px}#xonborder{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.5);border-radius:15px 15px 15px 15px;margin-bottom:30px;margin-left:0;padding:20px}#title{color:#08c;font-size:30px;margin-bottom:15px;position:relative;text-align:center;text-shadow:2px 2px 3px #333}.indexform{margin:20px 0 20px 0}.indexbox{width:250px}.navbar-brand{margin-left:0;padding-bottom:0;padding-top:10px;text-align:left}.navbar-inverse{background:none repeat scroll 0 0 rgba(0,0,0,0.6)}.navbar-inverse .nav>.active>a,.navbar-inverse .nav>.active>a:hover,.navbar-inverse .nav>.active>a:focus{background:none repeat scroll 0 0 rgba(49,49,49,0.6)}.navbar-inverse .nav>li>a,.navbar-brand{font-family:XoloniumNormal}.search,input[type="search"]{background-color:#606060;border:1px solid #202020;color:#aaa;width:100px}.game{float:left;min-width:700px;padding:10px 7px}.game a{color:#CCC}.game a:hover{color:#d95f00;text-decoration:none}.game tr{background-color:#000}.game tr.red{background-color:#4d0000}.game tr.blue{background-color:#00004d}.game tr.yellow{background-color:#4d4d00}.game tr.pink{background-color:#4d004d}.game tr:hover{background-color:#222}.teamscore{text-align:right;text-shadow:-1px -1px 0 #222;font-size:200%;font-weight:bold;padding:10px 7px;margin-right:10px;margin-top:20px}.teamscore .red{color:#ad0000}.teamscore .blue{color:#0000ad}.teamscore .yellow{color:#adad00}.teamscore .pink{color:#ad00ad}.player-score{color:#feff3a}.ping{width:50px}.weapon-nav{height:70px;margin-bottom:20px}.weapon-nav ul{display:block;list-style:none outside none}.weapon-nav li{cursor:pointer;float:left;margin-right:10px}.weapon-nav li:hover{border-bottom:2px solid #001021}.weapon-nav .weapon-active{border-bottom:2px solid #436688}.weapon-nav p{text-align:center}.flot table,.flot td{background-color:black;border:0}#gbtabcontainer{margin-top:10px}#gbtab{font-size:12px}.tabbable p{font-size:14px}.tabs-below .nav-tabs>li>a{border-radius:4px 4px 4px 4px}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>.active>a,.nav-tabs>.active>a:focus{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>li>a{border-radius:4px 4px 4px 4px;text-align:center}.nav-tabs>li>a:hover{background-color:#111;border-color:#333}.nav-tabs{border-bottom:0 solid #000}.table .tdcenter{text-align:center}.game-detail img{float:left;margin-right:10px;margin-bottom:5px}.game img{float:left;margin-right:5px;margin-bottom:5px}.game-detail p,.game h4{float:left}.teamscores tr{background-color:#000}.teamscores td{padding:3px;text-align:center;font-size:12px;font-weight:bold}.teamscores tr.red{background-color:#4d0000}.teamscores tr.blue{background-color:#00004d}.teamscores tr.yellow{background-color:#4d4d00}.teamscores tr.pink{background-color:#4d004d}.btn-toolbar .nav>li a{width:80px}.btn.dropdown-toggle,.btn.dropdown-toggle:active{background:0;border:1px solid transparent;border-radius:4px 4px 4px 4px;line-height:20px;color:#428bca;padding:10px 0 10px 0;font-size:14px;outline:0}.btn.dropdown-toggle:hover,.btn.dropdown-toggle:focus{background-color:#111;color:#2a6496;border-color:#333}.btn.dropdown-toggle>.caret{height:21px;border-top-color:#428bca;border-top-width:8px;border-left-width:8px;border-right-width:8px}.dropdown-menu{width:100px}.dropdown-menu.nav-tabs{padding:4px;background-color:#111;border:1px solid #333;width:256px}.dropdown-menu.nav-tabs>li>a{width:80px;color:inherit}.dropdown-menu.nav-tabs>li>a:hover{color:#222}.nostretch{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.player-nick{width:25%}.eloup{color:green}.elodown{color:#be0000}.eloneutral{color:gray}.pagination>li>a,.pagination>li>span{background-color:#111;border-color:#313131;color:#797979}.pagination>li>a:hover,.pagination>li>a:focus,.pagination>.active>a,.pagination>.active>span{background-color:#2b2222}@media(min-width:768px){.navbar-form{float:right}}
\ No newline at end of file
index 470a736d8cc067d20327771ce5d2719548f7cac3..8c94d4336bca7bd2fd0db08030ccd6f87ad9a8a8 100644 (file)
@@ -4,6 +4,14 @@
   <tbody>
   % for pgstat in pgstats:
     <tr class="${pgstat.team_html_color()}">
+      % if show_latency and pgstat.avg_latency is not None:
+        <td class="tdcenter">
+          ${int(round(pgstat.avg_latency))}
+        </td>
+      % elif show_latency:
+        <td class="tdcenter">-</td>
+      % endif
+
       <td class="player-nick">
         % if pgstat.player_id > 2:
           <a href="${request.route_url("player_info", id=pgstat.player_id)}"
           <span class="nick">${pgstat.nick_html_colors()|n}</span>
         % endif
       </td>
-      % if show_latency and pgstat.avg_latency is not None:
-        <td>
-          ${int(round(pgstat.avg_latency))}
-        </td>
-      % elif show_latency:
-        <td></td>
-      % endif
 
       ${scoreboard_row(game_type_cd, pgstat)}
 
 % if game_type_cd == 'as':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="suicides">Suicides</th>
 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="suicides">Suicides</th>
 % if game_type_cd == 'cq':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="captured">Captured</th>
 % if game_type_cd == 'cts':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="fastest">Fastest Time</th>
     <th class="deaths">Deaths</th>
   </tr>
 % if game_type_cd == 'ctf':
 <thead class="ctf ${pgstat.team_html_color()}">
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="captures">Captures</th>
     <th class="pickups">Pickups</th>
 % if game_type_cd == 'dom':
 <thead class="dom ${pgstat.team_html_color()}">
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="takes">Takes</th>
 % if game_type_cd in 'ft' 'freezetag':
 <thead class="freezetag ${pgstat.team_html_color()}">
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="revivals">Revivals</th>
 % if game_type_cd in 'ka' 'keepaway':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="pickups">Pickups</th>
 % if game_type_cd == 'kh':
 <thead class="kh ${pgstat.team_html_color()}">
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="kills">Kills</th>
     <th class="deaths">Deaths</th>
     <th class="pickups">Pickups</th>
 % if game_type_cd in 'nb' 'nexball':
 <thead class="nb ${pgstat.team_html_color()}">
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="goals">Goals</th>
     <th class="faults">Faults</th>
     <th class="score">Score</th>
 % if game_type_cd == 'rc':
 <thead>
   <tr>
-    <th class="nick">Nick</th>
     % if show_latency:
     <th class="ping">Ping</th>
     % endif
+    <th class="nick">Nick</th>
     <th class="laps">Laps</th>
     <th class="fastest">Fastest Lap</th>
     <th class="time">Time</th>
index f0cbb8257d187c5b15b5fe0f6296a7fff06e8a1d..0d7a9df80a01bcfe8122dad6099c73b6570fd80f 100644 (file)
@@ -86,10 +86,7 @@ def _game_info_data(request):
     else:
         show_elo = False
 
-    if request.params.has_key('show_latency'):
-        show_latency = True
-    else:
-        show_latency = False
+    show_latency = False
 
     try:
         notfound = False
@@ -106,6 +103,11 @@ def _game_info_data(request):
                 order_by(PlayerGameStat.score).\
                 all()
 
+        # if at least one player has a valid latency, we'll show the column
+        for pgstat in pgstats:
+            if pgstat.avg_latency is not None:
+                show_latency = True
+
         q = DBSession.query(TeamGameStat).\
                 filter(TeamGameStat.game_id == game_id)
         if game.game_type_cd == 'ctf':