bbbbbbbbbbbbbb

master
Aevann1 2022-01-16 02:10:33 +02:00
parent f52e104158
commit 8c0ddf3c96
2 changed files with 9 additions and 1 deletions

View File

@ -60,7 +60,8 @@ def remove_admin(v, username):
def distribute(v, comment):
try: comment = int(comment)
except: abort(400)
post = g.db.query(Comment).filter_by(id=comment).one_or_none().post
post = g.db.query(Comment.parent_submission).filter_by(id=comment).one_or_none()[0]
post = g.db.query(Submission).filter_by(id=post).one_or_none()
pool = 0
for option in post.bet_options: pool += option.upvotes
@ -86,6 +87,9 @@ def distribute(v, comment):
votes = g.db.query(CommentVote).filter(CommentVote.comment_id.in_(cids)).all()
for vote in votes: add_notif(cid, vote.user.id)
post.body += '\n\nclosed'
g.db.add(post)
g.db.commit()
return {"message": f"Each winner has received {coinsperperson} coins!"}

View File

@ -873,9 +873,13 @@ def remove_follow(username, v):
@app.get("/uid/<id>/pic")
@app.get("/uid/<id>/pic/profile")
@app.get("/logged_out/uid/<id>/pic")
@limiter.exempt
@auth_desired
def user_profile_uid(v, id):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): v = None
try: id = int(id)
except:
try: id = int(id, 36)