add negative bid protection to add_to_milestone

This commit is contained in:
Lili (Tlapka) 2023-03-26 13:11:31 +02:00
parent 3858a14f1a
commit 1937c5d660
1 changed files with 2 additions and 0 deletions

View File

@ -82,6 +82,8 @@ def add_to_milestone(db, user_id, redeem_name, points_donated):
progress, goal = row
if progress + points_donated > goal:
points_donated = goal - progress
if points_donated < 0:
points_donated = 0
if use_points(db, user_id, points_donated):
cursor = db.execute(
"UPDATE milestones SET progress = ? WHERE name = ?",