]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Acceptable version of the games breakdown tab.
authorAnt Zucaro <azucaro@gmail.com>
Wed, 26 Sep 2012 02:47:18 +0000 (22:47 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 26 Sep 2012 02:47:18 +0000 (22:47 -0400)
This version does not have localized time. More code changes are
needed to add it, and I just ran out of time. It is simple enough
to add and will come soon. This commit basically styles the tabs
and also adds a cap_ratio when you click on ctf.

xonstat/static/css/style.css
xonstat/templates/player_info.mako
xonstat/views/player.py

index dd29b0aa7f6f4e9b2cd2ea6387270f5e2b935cde..b47f14accc2561f54321792b34eceeadb022d914 100755 (executable)
@@ -3503,4 +3503,13 @@ header h2 { display:none; }
     background-color: black;
        border: 0;
 }
-
+/* Player Info Tabs */
+#gbtabcontainer { margin-top: 10px; }
+#gbtab { font-size: 12px; }
+.tabs-right .nav-tabs { border: none; }
+.nav-tabs > .active > a, .nav-tabs > .active > a:hover { background-color: #111; color: #aaa;}
+.tabs-right .nav-tabs > li > a { border-radius: 4px 4px 4px 4px; }
+.tabs-right .nav-tabs .active > a, .tabs-right .nav-tabs .active > a:hover { border-color: #222222 #222222 #222222 #222222; }
+.tabs-right .nav-tabs > li > a:hover { border-color: #222222 #222222 #222222 #222222; }
+.nav > li > a:hover { background-color: #333; color: #aaa; }
+.tabbable p { font-size: 14px; }
index 9787db8e32a04be1e388f8a36de4919da7f8eb7e..bdea7a541b90c3a42a1ff1f663427aaae97b9271 100644 (file)
@@ -17,6 +17,8 @@ ${nav.nav('players')}
             e.preventDefault();
             $(this).tab('show');
         })
+
+      $('#gbtab a:first').tab('show');
       })
       </script>
 
@@ -192,7 +194,7 @@ Player Information
 </div>
 
 <div class="row">
-  <div class="tabbable tabs-right">
+  <div id="gbtabcontainer" class="tabbable tabs-right">
       <ul id="gbtab" class="nav nav-tabs">
       % for g in games_played:
         <li><a href="#tab-${g.game_type_cd}" data-toggle="tab">${g.game_type_cd} (${g.games})</a></li>
@@ -207,30 +209,47 @@ Player Information
         % endif
         " id="tab-${g.game_type_cd}">
           <div class="span5">
+            <p>
             % if g.game_type_cd in overall_stats:
-            Last Played: ${overall_stats[g.game_type_cd].last_played} <br />
+            Last Played: <small>${overall_stats[g.game_type_cd].last_played.strftime('%a, %d %b %Y %H:%M UTC')} <br /></small>
             % endif
 
-            Games Played: ${g.games} <br />
+            Games Played: <small>${g.games} <br /></small>
 
             % if g.game_type_cd in fav_maps:
-            Favorite Map: ${fav_maps[g.game_type_cd].map_name} <br />
+            Favorite Map: <small>${fav_maps[g.game_type_cd].map_name} <br /></small>
             % endif
 
-            Win Percentage: ${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br />
-
+            Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
+            </p>
+          </div>
+          <div class="span5">
+            <p>
             % if g.game_type_cd in overall_stats:
-            Kill Ratio: ${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths) <br />
+            Kill Ratio: <small>${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths) <br /></small>
             % endif
 
             % if g.game_type_cd in elos:
-            Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br />
+              % if g.game_type_cd == 'overall':
+              Best Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games) <br /></small>
+              % else:
+              Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
+              % endif
             % endif
 
             % if g.game_type_cd in ranks:
-            Rank: ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} <br />
+              % if g.game_type_cd == 'overall':
+              Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd})<br /></small>
+
+              % else:
+              Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} <br /></small>
+              % endif
             % endif
 
+            % if g.game_type_cd == 'ctf':
+            Cap Ratio: <small>${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups) <br /></small>
+            % endif
+            </p>
           </div>
         </div>
       % endfor
index 36ca55dd1f588ffc0b258dc3ea3be6e7f6c381a3..29ce3deb93ca70a8d3ca65198bd2698dbbc5cd30 100644 (file)
@@ -190,7 +190,7 @@ def get_overall_stats(player_id):
             k_d_ratio = None
 
         try:
-            cap_ratio = float(row.total_pickups)/row.total_captures
+            cap_ratio = float(row.total_captures)/row.total_pickups
         except:
             cap_ratio = None