From 67fac37e44bce6fdc88945d5cda57ab285563df3 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:36:02 +1000 Subject: [PATCH] we can chat now? --- app.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index a74fa42..9a7cb9a 100644 --- a/app.py +++ b/app.py @@ -108,13 +108,16 @@ def post_a_post(post_key): ) cursor = db.aql.execute( """FOR ppp IN posts - LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) + LET children = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v) UPDATE ppp WITH { answers_num : COUNT_DISTINCT( children[*]._key ) } IN posts""" ) cursor = db.aql.execute( """FOR ppp IN posts - LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) + LET children0 = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v) + LET children = (FOR c IN children0 + SORT c._key DESC + RETURN c) UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts""" ) @@ -151,12 +154,15 @@ def post_to_post(post_key): ) cursor = db.aql.execute( """FOR ppp IN posts - LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) + LET children = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v) UPDATE ppp WITH { answers_num : COUNT_DISTINCT( children[*]._key ) } IN posts""" ) cursor = db.aql.execute( """FOR ppp IN posts - LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) + LET children0 = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v) + LET children = (FOR c IN children0 + SORT c._key DESC + RETURN c) UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts""" )