fdsfd
This commit is contained in:
parent
2b835b0bf1
commit
678c10fc11
1 changed files with 7 additions and 5 deletions
|
@ -150,9 +150,11 @@ def api_vote_comment(comment_id, new, v):
|
||||||
|
|
||||||
g.db.add(vote)
|
g.db.add(vote)
|
||||||
|
|
||||||
g.db.flush()
|
try:
|
||||||
comment.upvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=1).count()
|
g.db.flush()
|
||||||
comment.downvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=-1).count()
|
comment.upvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=1).count()
|
||||||
g.db.add(comment)
|
comment.downvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||||
g.db.commit()
|
g.db.add(comment)
|
||||||
|
g.db.commit()
|
||||||
|
except: g.db.rolleback()
|
||||||
return "", 204
|
return "", 204
|
Loading…
Add table
Add a link
Reference in a new issue