From 08d98aa4e6291824f66a55f259c8ffe4eb829126 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 29 Aug 2020 12:02:33 +0200 Subject: take activity status into consideration for list --- kalauerbot/bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kalauerbot/bot.py b/kalauerbot/bot.py index de95ade..448e3d0 100644 --- a/kalauerbot/bot.py +++ b/kalauerbot/bot.py @@ -154,11 +154,12 @@ class Kalauerbot(MatrixBot): say(f"the name '{name}' does not exist in the database, add the user before demanding a kalauer from him") self.save_db() elif command == "!list": - all_weight = sum([db[a]["weight"] for a in db if a != "__chosen__"]) + all_weight = sum([db[a]["weight"] for a in db if a != "__chosen__" and db[a]["active"]] ) txt = "Kalauer roster:\n\n" for name,entry in db.items(): if name == '__chosen__': continue - txt += f"* {name} - {entry['weight']} weight ({round(entry['weight']/all_weight * 100,1)}%) - {entry['total']} total {'(active)' if entry['active'] else '(inactive)'}\n" + prob = round(entry['weight']/all_weight * 100,1) + txt += f"* {name} - {entry['weight']} weight ({prob if entry['active'] else 0}%) - {entry['total']} total {'(active)' if entry['active'] else '(inactive)'}\n" say(txt) elif command == "!kill": name = args.strip() -- cgit v1.2.3