Merge pull request #7 from Aevann1/awardsfix

balls
remotes/1693045480750635534/spooky-22
fireworks88 2021-07-31 21:58:14 +00:00 committed by GitHub
commit cc3dc83941
1 changed files with 33 additions and 6 deletions

View File

@ -166,7 +166,7 @@ def badge_grant_post(v):
new_badge = Badge(badge_id=badge_id,
user_id=user.id,
created_utc=int(time.time())
#created_utc=int(time.time())
)
desc = request.form.get("description")
@ -188,11 +188,38 @@ def badge_grant_post(v):
send_notification(1046, user, text)
if badge_id in [21,22,23,24,28]:
user.patron = int(str(badge_id)[-1])
user.animatedname = True
# if badge_id == 23: user.banawards = 1
# elif badge_id in [24,28]: user.banawards = 3
g.db.add(user)
user.patron = int(str(badge_id)[-1])
user.animatedname = True
grant_awards = {}
if badge_id == 23:
grant_awards["ban"] = 1
grant_awards["shit"] = 5
elif badge_id in [24, 28]:
grant_awards["ban"] = 3
grant_awards["shit"] = 10
if len(grant_awards):
_awards = []
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
for name in grant_awards:
for count in range(grant_awards[name]):
thing += 1
_awards.append(AwardRelationship(
id=thing,
user_id=user.id,
kind=name
))
g.db.bulk_save_objects(_awards)
g.db.add(user)
return redirect(user.url)