we can chat now?
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-19 01:26:52 +10:00
parent 0b9f373486
commit 75f2d5a08f
2 changed files with 8 additions and 4 deletions

4
app.py
View File

@ -115,7 +115,7 @@ def post_a_post(post_key):
cursor = db.aql.execute( cursor = db.aql.execute(
"""FOR ppp IN posts """FOR ppp IN posts
LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) 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') postos = db.collection('posts')
@ -157,7 +157,7 @@ def post_to_post(post_key):
cursor = db.aql.execute( cursor = db.aql.execute(
"""FOR ppp IN posts """FOR ppp IN posts
LET children = (FOR v IN 1OUTBOUND ppp post_parents RETURN v) 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') postos = db.collection('posts')

View File

@ -36,7 +36,11 @@
<div class="collection"> <div class="collection">
{% for ans in posto.answers_list[0] %} {% for ans in posto.answers_list[0] %}
{% if (posto.answers_list[1])[loop.index-1] > 0 %} {% if (posto.answers_list[1])[loop.index-1] > 0 %}
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a> <a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
{% endif %}
{% else %} {% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }}</a> <a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
{% endif %} {% endif %}