]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Handle nonexistent elo deltas gracefully.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 7 Oct 2012 12:28:46 +0000 (08:28 -0400)
committerJan Behrens <zykure@web.de>
Sun, 23 Dec 2012 14:18:33 +0000 (15:18 +0100)
xonstat/templates/player_game_index.mako
xonstat/templates/player_info.mako
xonstat/views/player.py

index 1ed3b1575718c3c51aeeb3a5c80ea2733af2c21f..9b60e3cba4034d1d34099e03d40c3fc9c9b91471 100644 (file)
@@ -57,12 +57,16 @@ Recent Games
            </td>
            <td><span class="abstime" data-epoch="${g.game_epoch}" title="${g.game_create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${g.game_fuzzy}</span></td>
            <td class="tdcenter">
-             % if round(g.elo_delta,2) > 0:
-             <span title="Elo went up by ${round(g.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
-             % elif round(g.elo_delta,2) < 0:
-             <span title="Elo went down by ${round(g.elo_delta,2)}"><i class="icon-arrow-down icon-white"></i></span>
+             % if g.elo_delta is not None:
+               % if round(g.elo_delta,2) > 0:
+               <span title="Elo went up by ${round(g.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
+               % elif round(g.elo_delta,2) < 0:
+               <span title="Elo went down by ${round(g.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
            </td>
         </tr>
index 34737f67944e72d18444e72717a6fe8e8f574f9e..79ef981d8e8c731cd8550bc1d0623c80aade53d2 100644 (file)
@@ -457,12 +457,16 @@ 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 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>
+             % 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
            </td>
         </tr>
index 8d3c8bb17624dd0c10be980a67a756d180a6740f..d625dffbe1761d2fb3738f1ede3c9b5159b4717c 100644 (file)
@@ -654,7 +654,6 @@ def player_game_index_data(request):
         ) for row in games.items]
 
     except Exception as e:
-        raise e
         player = None
         games = None