remotes/1693045480750635534/spooky-22
Aevann1 2021-09-13 20:28:20 +02:00
parent e7de089648
commit b75152cc27
2 changed files with 7 additions and 0 deletions

View File

@ -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)

View File

@ -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,