From d7bb8743152f657f6cefc9f4bf1ac93b96e1b8c9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 18:50:59 +0200 Subject: [PATCH] dfdf --- files/routes/admin.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index be36a6031..ccef5fb32 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -111,8 +111,9 @@ def admin_home(v): @app.post("/admin/monthly") @admin_level_required(6) def monthly(v): - grant_awards = {} for u in g.db.query(User).filter(User.patron > 0).all(): + grant_awards = {} + if u.patron == 1: grant_awards["shit"] = 1 elif u.patron == 2: @@ -124,20 +125,20 @@ def monthly(v): grant_awards["shit"] = 10 grant_awards["ban"] = 3 - thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id + thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id - _awards = [] + _awards = [] - for name in grant_awards: - for count in range(grant_awards[name]): + for name in grant_awards: + for count in range(grant_awards[name]): - thing += 1 + thing += 1 - _awards.append(AwardRelationship( - id=thing, - user_id=v.id, - kind=name - )) + _awards.append(AwardRelationship( + id=thing, + user_id=u.id, + kind=name + )) g.db.bulk_save_objects(_awards)