Round up when checking zeroness

This commit is contained in:
jesopo 2018-08-10 14:00:33 +01:00
parent 6709fa1878
commit d89fcbfe46

View file

@ -85,8 +85,8 @@ class Module(object):
side_name = event["args_split"][0].lower() side_name = event["args_split"][0].lower()
coin_bet = event["args_split"][1] coin_bet = event["args_split"][1]
if not REGEX_FLOAT.match(coin_bet) or decimal.Decimal( if not REGEX_FLOAT.match(coin_bet) or round(decimal.Decimal(
coin_bet) <= DECIMAL_ZERO: coin_bet), 2) <= DECIMAL_ZERO:
event["stderr"].write("Please provide a number of coins to bet") event["stderr"].write("Please provide a number of coins to bet")
return return
coin_bet = decimal.Decimal(coin_bet) coin_bet = decimal.Decimal(coin_bet)
@ -117,8 +117,8 @@ class Module(object):
def send(self, event): def send(self, event):
send_amount = event["args_split"][1] send_amount = event["args_split"][1]
if not REGEX_FLOAT.match(send_amount) or decimal.Decimal( if not REGEX_FLOAT.match(send_amount) or round(decimal.Decimal(
send_amount) <= DECIMAL_ZERO: send_amount), 2) <= DECIMAL_ZERO:
event["stderr"].write( event["stderr"].write(
"Please provide a positive number of coins to send") "Please provide a positive number of coins to send")
return return