From e291d436409b69936b9f61c0543761543ac1d9e7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 4 Apr 2022 20:47:00 +0200 Subject: [PATCH] fds --- files/routes/front.py | 48 ++++++++++--------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index c3091f3c2..5331591ae 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -90,22 +90,10 @@ def notifications(v): next_exists = (len(notifications) > len(listing)) else: - unread = g.db.query(Notification, Comment).join(Comment).filter( - Notification.read == False, - Notification.user_id == v.id, - Comment.author_id != AUTOJANNY_ID, - Comment.body_html.notlike('

New rdrama mention:

New rdrama mention: 25) comments = comments[:25] - all = g.db.query(Comment, Notification.created_utc).join(Notification).filter( + all = g.db.query(Comment).join(Notification, Notification.comment_id == Comment.id).filter( Notification.user_id == v.id, Comment.is_banned == False, Comment.deleted_utc == 0, @@ -133,30 +118,19 @@ def notifications(v): Comment.parent_submission != None ).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(500).all() + print("3: " + str(time.time()-t)) + t = time.time() + + cids = [x.id for x in all] + comms = get_comments(cids, v=v) + listing = [] + print("4: " + str(time.time()-t)) t = time.time() - cids = [x[0].id for x in all] - - comms = get_comments(cids, v=v) - - listing = [] - print("5: " + str(time.time()-t)) t = time.time() - for c, n in all: - if n > 1620391248: c.notif_utc = n - c.replies2 = [] - parent = c.parent_comment - if parent and c.parent_submission: - if not parent.replies2: parent.replies2 = [c] - else: parent.replies2.append(c) - - - print("6: " + str(time.time()-t)) - t = time.time() - for c in comments: if c.parent_submission: while c.parent_comment and (c.parent_comment.author_id == v.id or c.parent_comment.id in cids): @@ -168,7 +142,7 @@ def notifications(v): if c not in listing: listing.append(c) - print("7: " + str(time.time()-t)) + print("6: " + str(time.time()-t)) print("all: " + str(time.time()-sex))