From f5fa89d7b5b857b649ea8d58846e37488d749d73 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 14 Aug 2017 12:52:43 +0200 Subject: add total to summary --- geldschieberbot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/geldschieberbot.py b/geldschieberbot.py index e33ba04..9626860 100644 --- a/geldschieberbot.py +++ b/geldschieberbot.py @@ -23,15 +23,19 @@ def send(msg): def create_summary(user): summary = "" + total = 0 p_balances = balance[user] # failes if user is not in balance for person in p_balances: amount = p_balances[person] if amount == 0: continue + total -= amount summary += "\t" + ("<-" if amount < 0 else "->") summary += " " + person + " " + str(abs(amount)) + "\n" if summary == "": summary = "\tAll fine :)\n" + else: + summary = "\tBalance: " + str(total) summary = user + ":\n" + summary return summary -- cgit v1.2.3