add negative bid protection to add_to_milestone
This commit is contained in:
parent
3858a14f1a
commit
1937c5d660
|
@ -82,6 +82,8 @@ def add_to_milestone(db, user_id, redeem_name, points_donated):
|
||||||
progress, goal = row
|
progress, goal = row
|
||||||
if progress + points_donated > goal:
|
if progress + points_donated > goal:
|
||||||
points_donated = goal - progress
|
points_donated = goal - progress
|
||||||
|
if points_donated < 0:
|
||||||
|
points_donated = 0
|
||||||
if use_points(db, user_id, points_donated):
|
if use_points(db, user_id, points_donated):
|
||||||
cursor = db.execute(
|
cursor = db.execute(
|
||||||
"UPDATE milestones SET progress = ? WHERE name = ?",
|
"UPDATE milestones SET progress = ? WHERE name = ?",
|
||||||
|
|
Loading…
Reference in New Issue