gfdg
This commit is contained in:
parent
7db8e6a373
commit
c71e3225c6
1 changed files with 20 additions and 24 deletions
|
@ -27,48 +27,44 @@ def notifications(v):
|
||||||
next_exists = (len(comments) > 25)
|
next_exists = (len(comments) > 25)
|
||||||
comments = comments[:25]
|
comments = comments[:25]
|
||||||
elif posts:
|
elif posts:
|
||||||
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(100).all()
|
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(101).all()
|
||||||
|
|
||||||
comments = []
|
next_exists = (len(notifications) > 100)
|
||||||
|
notifications = notifications[:100]
|
||||||
|
|
||||||
|
listing = []
|
||||||
|
|
||||||
for index, x in enumerate(notifications):
|
for index, x in enumerate(notifications):
|
||||||
c = x.comment
|
c = x.comment
|
||||||
if x.read and index > 26: break
|
if x.read and index > 25: break
|
||||||
elif not x.read:
|
elif not x.read:
|
||||||
c.unread = True
|
c.unread = True
|
||||||
x.read = True
|
x.read = True
|
||||||
g.db.add(x)
|
g.db.add(x)
|
||||||
comments.append(c)
|
listing.append(c)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
next_exists = (len(comments) > 25)
|
|
||||||
listing = comments[:25]
|
|
||||||
else:
|
else:
|
||||||
|
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id != AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(101).all()
|
||||||
|
|
||||||
notifications = v.notifications.join(Notification.comment).filter(
|
next_exists = (len(notifications) > 100)
|
||||||
Comment.is_banned == False,
|
notifications = notifications[:100]
|
||||||
Comment.deleted_utc == 0,
|
|
||||||
Comment.author_id != AUTOJANNY_ACCOUNT,
|
|
||||||
).order_by(Notification.id.desc()).offset(50 * (page - 1)).limit(51).all()
|
|
||||||
|
|
||||||
next_exists = (len(notifications) > 50)
|
listing = []
|
||||||
notifications = notifications[:50]
|
|
||||||
cids = [x.comment_id for x in notifications]
|
|
||||||
comments = get_comments(cids, v=v, load_parent=True)
|
|
||||||
|
|
||||||
i = 0
|
for index, x in enumerate(notifications):
|
||||||
for x in notifications:
|
c = x.comment
|
||||||
try:
|
if x.read and index > 25: break
|
||||||
if not x.read:
|
elif not x.read:
|
||||||
comments[i].unread = True
|
x.read = True
|
||||||
x.read = True
|
g.db.add(x)
|
||||||
g.db.add(x)
|
listing.append(c.id)
|
||||||
except: continue
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
|
comments = get_comments(listing, v=v, load_parent=True)
|
||||||
|
|
||||||
if not posts:
|
if not posts:
|
||||||
listing = []
|
listing = []
|
||||||
for c in comments:
|
for c in comments:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue