From 9767d19aeb962d24b99b4330476860b320bd410c Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 26 Aug 2012 00:15:36 -0400 Subject: [PATCH] Can't calculate the k:d ratio if d (deaths) is None. --- xonstat/batch/badges/gen_badges.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xonstat/batch/badges/gen_badges.py b/xonstat/batch/badges/gen_badges.py index d747c96..d59c336 100644 --- a/xonstat/batch/badges/gen_badges.py +++ b/xonstat/batch/badges/gen_badges.py @@ -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 -- 2.39.2