]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Can't calculate the k:d ratio if d (deaths) is None.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 26 Aug 2012 04:15:36 +0000 (00:15 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 26 Aug 2012 04:15:36 +0000 (00:15 -0400)
xonstat/batch/badges/gen_badges.py

index d747c96a772809547d495bd2d17cb29620e28ed1..d59c336dd3273dea1005035a4fc0320985f88c9d 100644 (file)
@@ -396,7 +396,8 @@ def render_image(data):
     ctx.move_to(kill_x-xoff-tw/2,kill_y+28-yoff-3)
     ctx.show_text(txt)
     ctx.set_source_rgb(0.8, 0.6, 0.6)
-    txt = "%d deaths" % total_stats['deaths']
+    if total_stats['deaths'] is not None:
+        txt = "%d deaths" % total_stats['deaths']
     xoff, yoff, tw, th = ctx.text_extents(txt)[:4]
     ctx.move_to(kill_x-xoff-tw/2,kill_y+38-yoff-3)
     ctx.show_text(txt)
@@ -435,7 +436,8 @@ players = DBSession.query(Player).\
         filter(Player.nick != None).\
         filter(Player.player_id > 2).\
         filter(Player.active_ind == True).\
-        limit(NUM_PLAYERS).all()
+        all()
+
 stop = datetime.now()
 td = stop-start
 total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6