forked from rDrama/rDrama
fix ping_cost not getting summed with previous value
parent
d2d13eeeee
commit
4623e7c1a3
|
@ -139,7 +139,7 @@ class Comment(Base):
|
||||||
ban_reason = Column(String)
|
ban_reason = Column(String)
|
||||||
treasure_amount = Column(String)
|
treasure_amount = Column(String)
|
||||||
slots_result = Column(String)
|
slots_result = Column(String)
|
||||||
ping_cost = Column(Integer)
|
ping_cost = Column(Integer, default=0)
|
||||||
blackjack_result = Column(String)
|
blackjack_result = Column(String)
|
||||||
casino_game_id = Column(Integer, ForeignKey("casino_games.id"))
|
casino_game_id = Column(Integer, ForeignKey("casino_games.id"))
|
||||||
chudded = Column(Boolean, default=False)
|
chudded = Column(Boolean, default=False)
|
||||||
|
|
|
@ -60,7 +60,7 @@ class Post(Base):
|
||||||
new = Column(Boolean)
|
new = Column(Boolean)
|
||||||
notify = Column(Boolean)
|
notify = Column(Boolean)
|
||||||
chudded = Column(Boolean, default=False)
|
chudded = Column(Boolean, default=False)
|
||||||
ping_cost = Column(Integer)
|
ping_cost = Column(Integer, default=0)
|
||||||
bump_utc = Column(Integer)
|
bump_utc = Column(Integer)
|
||||||
|
|
||||||
author = relationship("User", primaryjoin="Post.author_id==User.id")
|
author = relationship("User", primaryjoin="Post.author_id==User.id")
|
||||||
|
|
|
@ -210,7 +210,7 @@ def execute_snappy(post, v):
|
||||||
)
|
)
|
||||||
|
|
||||||
if ping_cost:
|
if ping_cost:
|
||||||
c.ping_cost = ping_cost
|
c.ping_cost += ping_cost
|
||||||
|
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None, followers_pi
|
||||||
|
|
||||||
v.charge_account('combined', cost)
|
v.charge_account('combined', cost)
|
||||||
if log_cost:
|
if log_cost:
|
||||||
log_cost.ping_cost = cost
|
log_cost.ping_cost += cost
|
||||||
return 'everyone'
|
return 'everyone'
|
||||||
elif i.group(1) == 'jannies':
|
elif i.group(1) == 'jannies':
|
||||||
group = None
|
group = None
|
||||||
|
@ -186,7 +186,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None, followers_pi
|
||||||
abort(403, f"You need {cost} coins to mention these ping groups!")
|
abort(403, f"You need {cost} coins to mention these ping groups!")
|
||||||
|
|
||||||
if log_cost:
|
if log_cost:
|
||||||
log_cost.ping_cost = cost
|
log_cost.ping_cost += cost
|
||||||
|
|
||||||
if i.group(1) in {'biofoids','neofoids','jannies'}:
|
if i.group(1) in {'biofoids','neofoids','jannies'}:
|
||||||
coin_receivers.update(member_ids)
|
coin_receivers.update(member_ids)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
update posts set ping_cost=0 where ping_cost is null;
|
||||||
|
alter table posts alter column ping_cost set not null;
|
||||||
|
update comments set ping_cost=0 where ping_cost is null;
|
||||||
|
alter table comments alter column ping_cost set not null;
|
Loading…
Reference in New Issue