From a213e668348327a7e9856803a283f59c6fea3754 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 17 May 2015 15:48:08 +0200 Subject: [PATCH] automatically disable sections without entrys --- tsstats.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tsstats.py b/tsstats.py index ac5c139..87a1a82 100755 --- a/tsstats.py +++ b/tsstats.py @@ -186,7 +186,15 @@ def render_template(): onlinetime_str = str(onlinetime) + 'm' onlinetime_desc[idx] = (clid, nick, onlinetime_str, clients[clid]['connected']) - + kicks_desc = desc('kicks') + pkicks_desc = desc('pkicks') + bans_desc = desc('bans') + if len(kicks_desc) <= 0: + show_kicks = False + if len(pkicks_desc) <= 0: + show_pkicks = False + if len(bans_desc) <= 0: + show_bans = False with open(output_path, 'w+') as f: f.write(template.render(title=title, onlinetime=onlinetime_desc, kicks=desc('kicks'), pkicks=desc('pkicks'), bans=desc('bans'), seconds='{}.{}'.format(generation_delta.seconds, generation_delta.microseconds), date=generation_end.strftime('%d.%m.%Y %H:%M'),