aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2017-08-14 12:52:43 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2017-08-14 12:52:43 +0200
commitf5fa89d7b5b857b649ea8d58846e37488d749d73 (patch)
tree7e1a1125f4c7e30ee43d4437da902068e76b3fa3
parentc2cc989a673d68b960249b42f7b659770bb1f65b (diff)
downloadgeldschieberbot-f5fa89d7b5b857b649ea8d58846e37488d749d73.tar.gz
geldschieberbot-f5fa89d7b5b857b649ea8d58846e37488d749d73.zip
add total to summary
-rw-r--r--geldschieberbot.py4
1 files changed, 4 insertions, 0 deletions
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