bug fix i think

This commit is contained in:
guams 2025-05-21 14:26:42 +02:00
parent 2449d0955b
commit f1dfc5668b
2 changed files with 3 additions and 3 deletions

View File

@ -291,8 +291,8 @@ async def minus_user_points(conn: connection, user_id: str, bet_value: int):
cur.execute(
"UPDATE member "
"SET points = points - %s "
"WHERE user_id=%s",
(bet_value, user_id)
"WHERE user_id = %s AND points - %s >= 50",
(bet_value, user_id, bet_value)
)
conn.commit()

View File

@ -35,7 +35,7 @@ CREATE TABLE member
user_id VARCHAR(255),
guild_id VARCHAR(255),
username VARCHAR(255),
points bigint DEFAULT 50 NOT NULL CHECK (points >= 50),
points bigint DEFAULT 50,
bet_value bigint DEFAULT 50,
PRIMARY KEY (user_id),
FOREIGN KEY (guild_id) REFERENCES guild (guild_id)