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:01:55 +10:00
parent c30e2c8705
commit 089b022a3b
2 changed files with 13 additions and 0 deletions

6
app.py
View File

@ -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)

View File

@ -36,6 +36,13 @@
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
<a href="#answer-post" hx-post="/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
</div>
{% if posto.answers_list | length > 0 %}
{% for ans in posto.answers_list %}
<div class="card-action right">
<a href="#post-{{ ans }}">>>{{ posto.ans }}</a>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>