remotes/1693045480750635534/spooky-22
Aevann1 2021-09-18 19:43:03 +02:00
parent a867902027
commit f724a74687
4 changed files with 12 additions and 8 deletions

View File

@ -185,7 +185,7 @@ def monthly(v):
send_notification(NOTIFICATIONS_ACCOUNT, u, text)
g.db.bulk_save_objects(_awards)
g.db.add_all(_awards)
g.db.commit()
return {"message": "Monthly awards granted"}
@ -424,7 +424,7 @@ def badge_grant_post(v):
kind=name
))
g.db.bulk_save_objects(_awards)
g.db.add_all(_awards)
text = "You were given the following awards:\n\n"

View File

@ -354,7 +354,7 @@ def admin_userawards_post(v):
kind=key
))
g.db.bulk_save_objects(awards)
g.db.add_all(awards)
text = "You were given the following awards:\n\n"
for key, value in notify_awards.items():

View File

@ -30,16 +30,18 @@ def notifications(v):
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all()
comments = []
notifs = []
for index, x in enumerate(notifications):
c = x.comment
if x.read and index > 26: break
elif not x.read:
c.unread = True
x.read = True
g.db.add(x)
notifs.append(x)
comments.append(c)
g.db.add(notifs)
g.db.commit()
next_exists = (len(comments) > 25)
@ -58,15 +60,17 @@ def notifications(v):
comments = get_comments(cids, v=v, load_parent=True)
i = 0
notifs = []
for x in notifications:
try:
if not x.read:
comments[i].unread = True
x.read = True
g.db.add(x)
notifs.append(x)
except: continue
i += 1
g.db.add(notifs)
g.db.commit()
if not posts:

View File

@ -354,7 +354,7 @@ def gumroad(v):
kind=name
))
g.db.bulk_save_objects(_awards)
g.db.add_all(_awards)
if not v.has_badge(20+tier):
new_badge = Badge(badge_id=20+tier,