From 75f2d5a08f8e3efeef20e4713de4dab44c386b24 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:26:52 +1000 Subject: [PATCH] we can chat now? --- app.py | 4 ++-- templates/i-posts.html | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 272c6f7..a74fa42 100644 --- a/app.py +++ b/app.py @@ -115,7 +115,7 @@ 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) - UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num ] } IN posts""" + UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts""" ) postos = db.collection('posts') @@ -157,7 +157,7 @@ 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) - UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num ] } IN posts""" + UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts""" ) postos = db.collection('posts') diff --git a/templates/i-posts.html b/templates/i-posts.html index 2bdfe06..161c288 100644 --- a/templates/i-posts.html +++ b/templates/i-posts.html @@ -35,8 +35,12 @@

Ответы:

{% for ans in posto.answers_list[0] %} - {% if (posto.answers_list[1])[loop.index-1] > 0 %} - >>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}) + {% if (posto.answers_list[1])[loop.index-1] > 0 %} + {% if (posto.answers_list[2])[loop.index-1] > 0 %} + >>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }}) + {% else %} + >>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}) + {% endif %} {% else %} >>{{ (posto.answers_list[0])[loop.index-1] }} {% endif %}