]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add more info to the player_info view and template
authorAnt Zucaro <azucaro@gmail.com>
Fri, 24 Jun 2011 15:36:33 +0000 (11:36 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Fri, 24 Jun 2011 15:36:33 +0000 (11:36 -0400)
xonstat/templates/player_info.mako
xonstat/views/main.py
xonstat/views/player.py

index e139f76769d3b20bdcccb7fa954666acce42ef69..e4147b991b5a0f3a9d1b5e6297f9ca8825b64b05 100755 (executable)
@@ -19,7 +19,7 @@ $(document).ready(function(){
 
 <%block name="title">
 % if player:
-Player Information for ${player.nick_html_colors()} - 
+Player Information for ${player.nick_strip_colors()} - 
 % endif
 
 ${parent.title()}
@@ -33,7 +33,11 @@ ${parent.title()}
 % else:
 <h2>${player.nick_html_colors()}</h2>
 <p>
-   Joined: ${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} <br />
+   Member Since: ${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} <br />
+   Last Seen: ${recent_games[0][1].fuzzy_date()} <br />
+   Playing Time: ${game_stats['total_alivetime']} <br />
+   Games Played: ${game_stats['total_games_played']} <br />
+   Average Rank: ${game_stats['avg_rank']} <br />
 </p>
 % endif
 
@@ -41,38 +45,35 @@ ${parent.title()}
 ##### STATS #####
 % if game_stats:
 <h2>Overall Game Stats</h2>
-<table class="accuracy-table" border="1" cellpadding="3">
-  <tr>
-    <td class="header-cell">Playing Time</td><td>${game_stats['total_alivetime']}</td>
-    <td class="header-cell">Drops</td><td>${game_stats['total_drops']}</td>
-  </tr>
+<table border="1" cellpadding="3">
+  
   <tr>
-    <td class="header-cell">Average Rank</td><td>${game_stats['avg_rank']}</td>
-    <td class="header-cell">Returns</td><td>${game_stats['total_returns']}</td>
+    <th>Score</td><td>${game_stats['total_score']}</td>
+    <th>Carrier Kills</td><td>${game_stats['total_carrier_frags']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Score</td><td>${game_stats['total_score']}</td>
-    <td class="header-cell">Carrier Kills</td><td>${game_stats['total_carrier_frags']}</td>
+    <th>Kills</td><td>${game_stats['total_kills']}</td>
+    <th>Collects</td><td>${game_stats['total_collects']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Kills</td><td>${game_stats['total_kills']}</td>
-    <td class="header-cell">Collects</td><td>${game_stats['total_collects']}</td>
+    <th>Deaths</td><td>${game_stats['total_deaths']}</td>
+    <th>Destroys</td><td>${game_stats['total_destroys']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Deaths</td><td>${game_stats['total_deaths']}</td>
-    <td class="header-cell">Destroys</td><td>${game_stats['total_destroys']}</td>
+    <th>Suicides</td><td>${game_stats['total_suicides']}</td>
+    <th>Destroys (with key)</td><td>${game_stats['total_destroys']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Suicides</td><td>${game_stats['total_suicides']}</td>
-    <td class="header-cell">Destroys (with key)</td><td>${game_stats['total_destroys']}</td>
+    <th>Captures</td><td>${game_stats['total_captures']}</td>
+    <th>Pushes</td><td>${game_stats['total_pushes']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Captures</td><td>${game_stats['total_captures']}</td>
-    <td class="header-cell">Pushes</td><td>${game_stats['total_pushes']}</td>
+    <th>Pickups</td><td>${game_stats['total_pickups']}</td>
+    <th>Pushed</td><td>${game_stats['total_pushed']}</td>
   </tr>
   <tr>
-    <td class="header-cell">Pickups</td><td>${game_stats['total_pickups']}</td>
-    <td class="header-cell">Pushed</td><td>${game_stats['total_pushed']}</td>
+    <th>Drops</td><td>${game_stats['total_drops']}</td>
+    <th>Returns</td><td>${game_stats['total_returns']}</td>
   </tr>
 </table>
 % endif
index b3bb04a917a0e87c751e0137633f8d9d67abaad3..c22fc88ce06fb6d5451e639ddf84f4c1c28b6c78 100755 (executable)
@@ -9,7 +9,7 @@ log = logging.getLogger(__name__)
 
 def main_index(request):
     leaderboard_count = 10
-    recent_games_count = 30
+    recent_games_count = 32
 
     # top players by score
     top_players = DBSession.query(Player.player_id, Player.nick, 
index 4dbed66f8a1dccc58ba98e1ec3d3d031e98bc443..8f8b4d6eb67c28ac8e656e742cf180e3dfb9a136 100755 (executable)
@@ -57,13 +57,15 @@ def player_info(request):
                 game_stats['total_destroys'], game_stats['total_dhk'], \r
                 game_stats['total_pushes'], game_stats['total_pushed'], \r
                 game_stats['total_carrier_frags'], \r
-                game_stats['total_alivetime']) = DBSession.\\r
+                game_stats['total_alivetime'],\r
+                game_stats['total_games_played']) = DBSession.\\r
                         query("avg_rank", "total_kills", "total_deaths", \r
                 "total_suicides", "total_score", "total_time", "total_held",\r
                 "total_captures", "total_pickups", "total_drops", \r
                 "total_returns", "total_collects", "total_destroys", \r
                 "total_dhk", "total_pushes", "total_pushed", \r
-                "total_carrier_frags", "total_alivetime").\\r
+                "total_carrier_frags", "total_alivetime", \r
+                "total_games_played").\\r
                 from_statement(\r
                     "select round(avg(rank)) avg_rank, sum(kills) total_kills, "\r
                     "sum(deaths) total_deaths, sum(suicides) total_suicides, "\r
@@ -74,7 +76,7 @@ def player_info(request):
                     "sum(destroys) total_destroys, sum(destroys_holding_key) total_dhk, "\r
                     "sum(pushes) total_pushes, sum(pushed) total_pushed, "\r
                     "sum(carrier_frags) total_carrier_frags, "\r
-                    "sum(alivetime) total_alivetime "\r
+                    "sum(alivetime) total_alivetime, count(*) total_games_played "\r
                     "from player_game_stats "\r
                     "where player_id=:player_id"\r
                 ).params(player_id=player_id).one()\r