fd
This commit is contained in:
parent
835f99847f
commit
8db44df83a
2 changed files with 7 additions and 0 deletions
|
@ -98,6 +98,7 @@ class User(Base, Stndrd, Age_times):
|
|||
login_nonce = Column(Integer, default=0)
|
||||
reserved = Column(String(256))
|
||||
coins = Column(Integer, default=0)
|
||||
truecoins = Column(Integer, default=0)
|
||||
mfa_secret = deferred(Column(String(16)))
|
||||
is_private = Column(Boolean, default=False)
|
||||
stored_subscriber_count = Column(Integer, default=0)
|
||||
|
|
|
@ -76,15 +76,18 @@ def api_vote_post(post_id, new, v):
|
|||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
post.author.coins += 1
|
||||
post.author.truecoins += 1
|
||||
g.db.add(post.author)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
post.author.coins -= 1
|
||||
post.author.truecoins -= 1
|
||||
g.db.add(post.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
else:
|
||||
if new != 0:
|
||||
post.author.coins += 1
|
||||
post.author.truecoins += 1
|
||||
g.db.add(post.author)
|
||||
vote = Vote(user_id=v.id,
|
||||
vote_type=new,
|
||||
|
@ -126,15 +129,18 @@ def api_vote_comment(comment_id, new, v):
|
|||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
comment.author.coins += 1
|
||||
comment.author.truecoins += 1
|
||||
g.db.add(comment.author)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
comment.author.coins -= 1
|
||||
comment.author.truecoins -= 1
|
||||
g.db.add(comment.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
else:
|
||||
if new != 0:
|
||||
comment.author.coins += 1
|
||||
comment.author.truecoins += 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