dfsfs
This commit is contained in:
parent
d504c6eb25
commit
b74946da3b
1 changed files with 7 additions and 5 deletions
|
@ -96,11 +96,13 @@ def api_vote_post(post_id, new, v):
|
||||||
)
|
)
|
||||||
g.db.add(vote)
|
g.db.add(vote)
|
||||||
|
|
||||||
|
try:
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
post.upvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=1).count()
|
post.upvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=1).count()
|
||||||
post.downvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=-1).count()
|
post.downvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
except: g.db.rollback()
|
||||||
return "", 204
|
return "", 204
|
||||||
|
|
||||||
@app.post("/vote/comment/<comment_id>/<new>")
|
@app.post("/vote/comment/<comment_id>/<new>")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue