Fix error caused by negative or really big numbers

This commit is contained in:
Maveth 2021-11-23 12:24:14 -06:00
parent ee5eb13bec
commit bb4281270c

View File

@ -36,10 +36,11 @@ def validate_dollars():
dollars = decimal.Decimal(request.form["dollars"])
except:
errors.append("dollars must be a number")
# TODO re enable this
# if dollars and dollars < decimal.Decimal(1):
# errors.append("dollars must be >= 1")
if dollars and dollars < decimal.Decimal(1):
errors.append("dollars must be >= 1")
elif dollars and dollars >= decimal.Decimal(1000000):
errors.append("dollars must be < 1,000,000")
return [errors, dollars]