summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-08-29 12:02:33 +0200
committermakefu <github@syntax-fehler.de>2020-08-29 12:02:33 +0200
commit08d98aa4e6291824f66a55f259c8ffe4eb829126 (patch)
tree06b17dfdb0c357f53c6a00393b20727951b0a6c9
parentee694e9e7e65877403d1df1f2e47118c388bd634 (diff)
take activity status into consideration for list
-rw-r--r--kalauerbot/bot.py5
1 files 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()