fsd
This commit is contained in:
parent
06ce33d1f6
commit
a8b5892d90
1 changed files with 4 additions and 2 deletions
|
@ -104,13 +104,15 @@ def notifications(v):
|
||||||
|
|
||||||
print("1: " + str(time.time() - t), flush=True)
|
print("1: " + str(time.time() - t), flush=True)
|
||||||
|
|
||||||
comments = g.db.query(Comment).join(Notification).distinct(Comment.top_comment_id).filter(
|
sq = g.db.query(Comment).join(Notification).distinct(Comment.top_comment_id).filter(
|
||||||
Notification.user_id == v.id,
|
Notification.user_id == v.id,
|
||||||
Comment.is_banned == False,
|
Comment.is_banned == False,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id != AUTOJANNY_ID,
|
Comment.author_id != AUTOJANNY_ID,
|
||||||
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
||||||
).order_by(Comment.id.desc(), Comment.top_comment_id.desc()).offset(25 * (page - 1)).limit(26).all()
|
).order_by(Comment.top_comment_id.desc()).subquery()
|
||||||
|
|
||||||
|
comments = g.db.query(sq.c).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
||||||
|
|
||||||
next_exists = (len(comments) > 25)
|
next_exists = (len(comments) > 25)
|
||||||
comments = comments[:25]
|
comments = comments[:25]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue