bvcvb
This commit is contained in:
parent
2a4818177a
commit
6ec552c804
4 changed files with 5 additions and 13 deletions
|
@ -43,7 +43,7 @@ class Comment(Base):
|
||||||
body = Column(String)
|
body = Column(String)
|
||||||
body_html = Column(String)
|
body_html = Column(String)
|
||||||
ban_reason = Column(String)
|
ban_reason = Column(String)
|
||||||
slots_result = Column(String, default="")
|
slots_result = Column(String)
|
||||||
|
|
||||||
post = relationship("Submission", viewonly=True)
|
post = relationship("Submission", viewonly=True)
|
||||||
author = relationship("User", primaryjoin="User.id==Comment.author_id")
|
author = relationship("User", primaryjoin="User.id==Comment.author_id")
|
||||||
|
|
|
@ -44,8 +44,7 @@ class Slots:
|
||||||
result = self.pull_the_arm(from_user, wagerValue, from_comment)
|
result = self.pull_the_arm(from_user, wagerValue, from_comment)
|
||||||
return { 'pulled': True, 'result': result }
|
return { 'pulled': True, 'result': result }
|
||||||
|
|
||||||
except ValueError:
|
except exception as e: break
|
||||||
break
|
|
||||||
return { 'pulled': False, 'result': '' }
|
return { 'pulled': False, 'result': '' }
|
||||||
|
|
||||||
# Ensure user is capable of the wager
|
# Ensure user is capable of the wager
|
||||||
|
@ -133,13 +132,9 @@ class Slots:
|
||||||
# Credit the user's account
|
# Credit the user's account
|
||||||
def credit_user(self, from_user, amount):
|
def credit_user(self, from_user, amount):
|
||||||
from_user.coins += amount
|
from_user.coins += amount
|
||||||
|
|
||||||
self.db.add(from_user)
|
self.db.add(from_user)
|
||||||
self.db.commit()
|
|
||||||
|
|
||||||
# Charge the user's account
|
# Charge the user's account
|
||||||
def charge_user(self, from_user, amount):
|
def charge_user(self, from_user, amount):
|
||||||
from_user.coins -= amount
|
from_user.coins -= amount
|
||||||
|
|
||||||
self.db.add(from_user)
|
self.db.add(from_user)
|
||||||
self.db.commit()
|
|
||||||
|
|
|
@ -558,17 +558,14 @@ def api_comment(v):
|
||||||
c.upvotes += 1
|
c.upvotes += 1
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
# Slots
|
|
||||||
slots = Slots(g)
|
slots = Slots(g)
|
||||||
slots_check = slots.check_for_slots_command(body, v, c)
|
slots_check = slots.check_for_slots_command(body, v, c)
|
||||||
|
|
||||||
if (slots_check['pulled'] == True):
|
if (slots_check['pulled'] == True):
|
||||||
c.slots_result = slots_check['result']
|
c.slots_result = slots_check['result']
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
if request.headers.get("Authorization"): return c.json
|
if request.headers.get("Authorization"): return c.json
|
||||||
return render_template("comments.html", v=v, comments=[c])
|
return render_template("comments.html", v=v, comments=[c])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue