fdfd
This commit is contained in:
parent
254995d1e4
commit
90815f5fba
16 changed files with 70 additions and 108 deletions
|
@ -73,16 +73,16 @@ def api_vote_post(post_id, new, v):
|
|||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
post.author.dramacoins += 1
|
||||
post.author.coins += 1
|
||||
g.db.add(post.author)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
post.author.dramacoins -= 1
|
||||
post.author.coins -= 1
|
||||
g.db.add(post.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
else:
|
||||
if new != 0:
|
||||
post.author.dramacoins += 1
|
||||
post.author.coins += 1
|
||||
g.db.add(post.author)
|
||||
vote = Vote(user_id=v.id,
|
||||
vote_type=new,
|
||||
|
@ -121,16 +121,16 @@ def api_vote_comment(comment_id, new, v):
|
|||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
comment.author.dramacoins += 1
|
||||
comment.author.coins += 1
|
||||
g.db.add(comment.author)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
comment.author.dramacoins -= 1
|
||||
comment.author.coins -= 1
|
||||
g.db.add(comment.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
else:
|
||||
if new != 0:
|
||||
comment.author.dramacoins += 1
|
||||
comment.author.coins += 1
|
||||
g.db.add(comment.author)
|
||||
vote = CommentVote(user_id=v.id,
|
||||
vote_type=new,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue