f
This commit is contained in:
parent
c7f2275319
commit
b85cf076f1
2 changed files with 2 additions and 2 deletions
|
@ -115,7 +115,7 @@ def api_vote_post(post_id, new, v):
|
|||
g.db.flush()
|
||||
post.upvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1).count()
|
||||
post.downvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
post.realupvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=True).count() - g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=False).count() + g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
post.realupvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1, real=True).count() + g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
if post.author.progressivestack: post.realupvotes *= 2
|
||||
g.db.add(post)
|
||||
g.db.commit()
|
||||
|
@ -181,7 +181,7 @@ def api_vote_comment(comment_id, new, v):
|
|||
g.db.flush()
|
||||
comment.upvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1).count()
|
||||
comment.downvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
comment.realupvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=True).count() - g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=False).count() + g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
comment.realupvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1, real=True).count() + g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
if comment.author.progressivestack: comment.realupvotes *= 2
|
||||
g.db.add(comment)
|
||||
g.db.commit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue