This commit is contained in:
parent
0b9f373486
commit
75f2d5a08f
4
app.py
4
app.py
@ -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')
|
||||||
|
@ -35,8 +35,12 @@
|
|||||||
<p>Ответы:</p>
|
<p>Ответы:</p>
|
||||||
<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 %}
|
||||||
<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>
|
{% 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>
|
||||||
|
{% 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 %}
|
||||||
|
Loading…
Reference in New Issue
Block a user