check posts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-14 01:40:19 +10:00
parent 6add3fe85d
commit 6d9caa78f2
2 changed files with 10 additions and 1 deletions

6
app.py
View File

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

View File

@ -19,7 +19,10 @@
</div>
<div class="col s8">
<div class="card-content white-text">
<span class="card-title">#{{ posto._key }} <span class="new badge red" data-badge-caption="">Ответов: {{ posto.children_num }}</span></span>
<span class="card-title">#{{ posto._key }}
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
</span>
<p>{{ posto.texto }}</p>
</div>
</div>