forked from rDrama/rDrama
1
0
Fork 0
master
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) send_notification(NOTIFICATIONS_ACCOUNT, u, text)
g.db.bulk_save_objects(_awards) g.db.add_all(_awards)
g.db.commit() g.db.commit()
return {"message": "Monthly awards granted"} return {"message": "Monthly awards granted"}
@ -424,7 +424,7 @@ def badge_grant_post(v):
kind=name kind=name
)) ))
g.db.bulk_save_objects(_awards) g.db.add_all(_awards)
text = "You were given the following awards:\n\n" text = "You were given the following awards:\n\n"

View File

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

View File

@ -30,6 +30,7 @@ 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() 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 = [] comments = []
notifs = []
for index, x in enumerate(notifications): for index, x in enumerate(notifications):
c = x.comment c = x.comment
@ -37,9 +38,10 @@ def notifications(v):
elif not x.read: elif not x.read:
c.unread = True c.unread = True
x.read = True x.read = True
g.db.add(x) notifs.append(x)
comments.append(c) comments.append(c)
g.db.add(notifs)
g.db.commit() g.db.commit()
next_exists = (len(comments) > 25) next_exists = (len(comments) > 25)
@ -58,15 +60,17 @@ def notifications(v):
comments = get_comments(cids, v=v, load_parent=True) comments = get_comments(cids, v=v, load_parent=True)
i = 0 i = 0
notifs = []
for x in notifications: for x in notifications:
try: try:
if not x.read: if not x.read:
comments[i].unread = True comments[i].unread = True
x.read = True x.read = True
g.db.add(x) notifs.append(x)
except: continue except: continue
i += 1 i += 1
g.db.add(notifs)
g.db.commit() g.db.commit()
if not posts: if not posts:

View File

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