forked from rDrama/rDrama
dfMerge branch 'master' of https://github.com/Aevann1/Drama
commit
5013f3265f
|
@ -90,7 +90,6 @@ def api_vote_post(post_id, new, v):
|
|||
g.db.add(post.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
g.db.commit()
|
||||
else:
|
||||
if new != 0:
|
||||
post.author.dramacoins += 1
|
||||
|
@ -101,8 +100,8 @@ def api_vote_post(post_id, new, v):
|
|||
app_id=v.client.application.id if v.client else None
|
||||
)
|
||||
g.db.add(vote)
|
||||
g.db.commit()
|
||||
|
||||
|
||||
g.db.flush()
|
||||
post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count()
|
||||
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
g.db.add(post)
|
||||
|
@ -138,7 +137,6 @@ def api_vote_comment(comment_id, new, v):
|
|||
g.db.add(comment.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
g.db.commit()
|
||||
else:
|
||||
if new != 0:
|
||||
comment.author.dramacoins += 1
|
||||
|
@ -150,8 +148,8 @@ def api_vote_comment(comment_id, new, v):
|
|||
)
|
||||
|
||||
g.db.add(vote)
|
||||
g.db.commit()
|
||||
|
||||
|
||||
g.db.flush()
|
||||
comment.upvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=1).count()
|
||||
comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
g.db.add(comment)
|
||||
|
|
Loading…
Reference in New Issue