fix (data): Cap coin updates.

Fixes an issue where the session system could overflow `members.coins`.
This commit is contained in:
2022-01-24 06:32:00 +02:00
parent e964e12fa7
commit b213283d95
4 changed files with 64 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ def add_pending(pending):
"""
UPDATE members
SET
coins = coins + t.coin_diff
coins = LEAST(coins + t.coin_diff, 2147483647)
FROM
(VALUES %s)
AS

View File

@@ -77,6 +77,7 @@ class hourly_reward(settings.Integer, settings.GuildSetting):
desc = "Number of LionCoins given per hour of study."
_default = 50
_max = 32767
long_desc = (
"Each spent in a voice channel will reward this number of LionCoins."
@@ -99,6 +100,7 @@ class hourly_live_bonus(settings.Integer, settings.GuildSetting):
desc = "Number of extra LionCoins given for a full hour of streaming (via go live or video)."
_default = 10
_max = 32767
long_desc = (
"LionCoin bonus earnt for every hour a member streams in a voice channel, including video. "