master
Aevann1 2021-08-22 18:50:59 +02:00
parent 9ced3889fb
commit d7bb874315
1 changed files with 12 additions and 11 deletions

View File

@ -111,8 +111,9 @@ def admin_home(v):
@app.post("/admin/monthly") @app.post("/admin/monthly")
@admin_level_required(6) @admin_level_required(6)
def monthly(v): def monthly(v):
grant_awards = {}
for u in g.db.query(User).filter(User.patron > 0).all(): for u in g.db.query(User).filter(User.patron > 0).all():
grant_awards = {}
if u.patron == 1: if u.patron == 1:
grant_awards["shit"] = 1 grant_awards["shit"] = 1
elif u.patron == 2: elif u.patron == 2:
@ -124,20 +125,20 @@ def monthly(v):
grant_awards["shit"] = 10 grant_awards["shit"] = 10
grant_awards["ban"] = 3 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 name in grant_awards:
for count in range(grant_awards[name]): for count in range(grant_awards[name]):
thing += 1 thing += 1
_awards.append(AwardRelationship( _awards.append(AwardRelationship(
id=thing, id=thing,
user_id=v.id, user_id=u.id,
kind=name kind=name
)) ))
g.db.bulk_save_objects(_awards) g.db.bulk_save_objects(_awards)