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))