From 1937c5d660a5b2c3fd364c63ca9837a6eda508c5 Mon Sep 17 00:00:00 2001 From: Lili Date: Sun, 26 Mar 2023 13:11:31 +0200 Subject: [PATCH] add negative bid protection to add_to_milestone --- tlapbot/redeems.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tlapbot/redeems.py b/tlapbot/redeems.py index 8daeb22..879f226 100644 --- a/tlapbot/redeems.py +++ b/tlapbot/redeems.py @@ -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 = ?",