diff --git a/app.py b/app.py index a7945e3..ccce6b8 100644 --- a/app.py +++ b/app.py @@ -86,11 +86,17 @@ def post_a_post(post_key): }, overwrite_mode='update') + cursor = db.aql.execute( """FOR ppp IN posts LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v) UPDATE ppp WITH { children_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_num : COUNT_DISTINCT( 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 b0e13ab..1e28c82 100644 --- a/templates/i-posts.html +++ b/templates/i-posts.html @@ -19,7 +19,10 @@
- #{{ posto._key }} Ответов: {{ posto.children_num }} + #{{ posto._key }} + Ответов: {{ posto.answers_num }} + Длина треда: {{ posto.children_num }} +

{{ posto.texto }}