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 %} +
+ >>{{ posto.ans }} +
+ {% endfor %} + {% endif %}