This commit is contained in:
parent
6add3fe85d
commit
6d9caa78f2
6
app.py
6
app.py
@ -86,11 +86,17 @@ def post_a_post(post_key):
|
|||||||
}, overwrite_mode='update')
|
}, overwrite_mode='update')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cursor = db.aql.execute(
|
cursor = db.aql.execute(
|
||||||
"""FOR ppp IN posts
|
"""FOR ppp IN posts
|
||||||
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
|
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
|
||||||
UPDATE ppp WITH { children_num : COUNT_DISTINCT( children[*]._key ) } IN posts"""
|
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 = db.collection('posts')
|
||||||
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
|
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col s8">
|
<div class="col s8">
|
||||||
<div class="card-content white-text">
|
<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>
|
<p>{{ posto.texto }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user