From 7e416e15b93b044622cc9b543259a12c84cf6f55 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Fri, 30 Jul 2021 18:44:39 +0200 Subject: [PATCH] sneed --- drama/routes/awards.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drama/routes/awards.py b/drama/routes/awards.py index 85c8a7dd0..9a86d5b6e 100644 --- a/drama/routes/awards.py +++ b/drama/routes/awards.py @@ -188,6 +188,7 @@ def admin_userawards_post(v): u = get_user(request.form.get("username", '1'), graceful=False, v=v) awards = [] + notify_awards = {} latest = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first() thing = latest.id @@ -197,6 +198,10 @@ def admin_userawards_post(v): continue if value: + + if int(value) > 0: + notify_awards[key] = int(value) + for x in range(int(value)): thing += 1 @@ -207,5 +212,11 @@ def admin_userawards_post(v): )) g.db.bulk_save_objects(awards) + text = "You were given the following awards:\n\n" + + for key, value in notify_awards.items(): + text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n" + + send_notification(1, u, text) return render_template("admin/user_award.html", awards=list(AWARDS.values()), v=v)