From 089b022a3b7b41e921caecf7f00cdbc40b04baf6 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:01:55 +1000 Subject: [PATCH] we can chat now? --- app.py | 6 ++++++ templates/i-posts.html | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app.py b/app.py index 07f9e75..e9534bc 100644 --- a/app.py +++ b/app.py @@ -112,6 +112,12 @@ def post_a_post(post_key): 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) + UPDATE ppp WITH { answers_list : children[*]._key } IN posts""" + ) + postos = db.collection('posts') postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) diff --git a/templates/i-posts.html b/templates/i-posts.html index 20594c9..a276d84 100644 --- a/templates/i-posts.html +++ b/templates/i-posts.html @@ -36,6 +36,13 @@ Ответить этому. + {% if posto.answers_list | length > 0 %} + {% for ans in posto.answers_list %} +
+ {% endfor %} + {% endif %}