]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Provide an option to show elo deltas on the game info page.
authorAnt Zucaro <azucaro@gmail.com>
Wed, 14 Nov 2012 04:02:56 +0000 (23:02 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 14 Nov 2012 04:02:56 +0000 (23:02 -0500)
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
xonstat/templates/player_info.mako
xonstat/templates/scoreboard.mako
xonstat/views/game.py

index 0e3a383ba9c8eb1aa0030bc272cce393e05219ef..44d1f9c63d756f36a32cf00df359b367891bd50d 100644 (file)
@@ -42,7 +42,7 @@ Game Information
 <div class="row">
   <div class="span12 game">
     <h3>Scoreboard</h3>
-    ${scoreboard(game.game_type_cd, pgstats)}
+    ${scoreboard(game.game_type_cd, pgstats, show_elo)}
   </div>
 </div>
 
index 2ae8709636b1ec663a1505ba023a870f5f1bf6a8..4ad859b07ddd2b33ef09deeb5680d70c775fc1a2 100644 (file)
@@ -457,17 +457,19 @@ Player Information
            </td>
            <td><span class="abstime" data-epoch="${game.epoch()}" title="${game.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span></td>
            <td class="tdcenter">
-             % if gamestat.elo_delta is not None:
-               % if round(gamestat.elo_delta,2) > 0:
-               <span title="Elo went up by ${round(gamestat.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
-               % elif round(gamestat.elo_delta,2) < 0:
-               <span title="Elo went down by ${round(-gamestat.elo_delta,2)}"><i class="icon-arrow-down icon-white"></i></span>
+             <a href="${request.route_url('game_info', id=game.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
+               % if gamestat.elo_delta is not None:
+                 % if round(gamestat.elo_delta,2) > 0:
+                 <span title="Elo went up by ${round(gamestat.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
+                 % elif round(gamestat.elo_delta,2) < 0:
+                 <span title="Elo went down by ${round(-gamestat.elo_delta,2)}"><i class="icon-arrow-down icon-white"></i></span>
+                 % else:
+                 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
+                 % endif
                % else:
-               <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
+                 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
                % endif
-             % else:
-               <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
-             % endif
+             </a>
            </td>
         </tr>
       % endfor
index 1ce98e8908ba391e55c855372efc4969175dd3ff..5064bb1244a05d61883a02d484ee78d5a50d575b 100644 (file)
@@ -1,4 +1,4 @@
-<%def name="scoreboard(game_type_cd, pgstats)">
+<%def name="scoreboard(game_type_cd, pgstats, show_elo=False)">
 <table  class="table table-bordered table-condensed">
 ${scoreboard_header(game_type_cd, pgstats[0])}
   <tbody>
@@ -19,8 +19,15 @@ ${scoreboard_header(game_type_cd, pgstats[0])}
         ${int(round(pgstat.avg_latency))}
       </td>
       % endif
-    ${scoreboard_row(game_type_cd, pgstat)}
+      ${scoreboard_row(game_type_cd, pgstat)}
       <td>${pgstat.score}</td>
+      % if show_elo:
+        % if pgstat.elo_delta is not None:
+        <td>${round(pgstat.elo_delta,2)}</td>
+        % else:
+        <td>-</td>
+        % endif
+      % endif
     </tr>
   % endfor
   </tbody>
@@ -40,6 +47,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])}
       <th class="deaths">Deaths</th>
       <th class="suicides">Suicides</th>
       <th class="score">Score</th>
+      % if show_elo:
+      <th>Elo Change</th>
+      % endif
     </tr>
     </thead>
 % endif
@@ -57,6 +67,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])}
       <th class="fck" title="Flag Carrier Kill">FCK</th>
       <th class="returns">Returns</th>
       <th class="score">Score</th>
+      % if show_elo:
+      <th>Elo Change</th>
+      % endif
     </tr>
     </thead>
 % endif
@@ -70,6 +83,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])}
       % endif
       <th class="kills">Kills</th>
       <th class="score">Score</th>
+      % if show_elo:
+      <th>Elo Change</th>
+      % endif
     </tr>
     </thead>
 % endif
@@ -85,6 +101,9 @@ ${scoreboard_header(game_type_cd, pgstats[0])}
       <th class="deaths">Deaths</th>
       <th class="suicides">Suicides</th>
       <th class="score">Score</th>
+      % if show_elo:
+      <th>Elo Change</th>
+      % endif
     </tr>
     </thead>
 % endif
index 2e088b8616282f28ff47bfcc1f5c614e6341d0ec..f9389e0bc10821a4c73aae68324c96ee44b625c1 100644 (file)
@@ -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,
             }