From 6d9caa78f2b411960f4ff5304588f56b9d1dd1d9 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Fri, 14 Jul 2023 01:40:19 +1000 Subject: [PATCH] check posts --- app.py | 6 ++++++ templates/i-posts.html | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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.texto }}