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

This commit is contained in:
Simple_Not
2023-07-19 00:14:13 +10:00
parent 1e2d39a5c0
commit e7fee4999e
2 changed files with 46 additions and 16 deletions

37
app.py
View File

@@ -102,6 +102,43 @@ def post_a_post(post_key):
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
@app.route('/post_to_another_post/<post_key>', methods=['POST'])
def post_a_post(post_key):
postos = db.collection('posts')
data = request.form['send_this_text']
metadata = postos.insert({
'texto': data,
'parent_post': f'{post_key}'
}, overwrite_mode='update')
metadata = db.collection('post_parents').insert({
'_from': f'posts/{post_key}',
'_to': f'posts/{metadata["_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)
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
# @app.route('/post_my_file', method=['POST'])
# def post_a_file():
# pass