Exemplo n.º 1
0
 def _check_amount(self, user_id, amount):
     if amount % 10 != 0:
         raise BetNotInTensError, "Bad amount %d" % amount
     if amount < 10:
         raise MinimumBetError, "Bet must be at least ten: %d" % amount
     if amount > self.max_bet:
         msg = "Bet must be no more than %d: amount %d"
         raise MaximumBetError, msg % (self.max_bet, amount)
     acct = self.accounts.get(user_id)
     balance = acct.balance.balance
     max_bet = determine_max_bet(balance)
     if amount > max_bet:
         juice_insurance = amount / 10
         total = amount + juice_insurance
         msg = "Total needed %d, current balance %d" % (total, balance)
         raise InsufficientFundsError, msg
     return True
Exemplo n.º 2
0
 def _check_amount(self, user_id, amount):
     if amount % 10 != 0:
         raise BetNotInTensError, "Bad amount %d" % amount
     if amount < 10:
         raise MinimumBetError, "Bet must be at least ten: %d" % amount
     if amount > self.max_bet:
         msg = "Bet must be no more than %d: amount %d"
         raise MaximumBetError, msg % (self.max_bet, amount)
     acct = self.accounts.get(user_id)
     balance = acct.balance.balance
     max_bet = determine_max_bet(balance)
     if amount > max_bet:
         juice_insurance = amount / 10
         total = amount + juice_insurance
         msg = "Total needed %d, current balance %d" % (total, balance)
         raise InsufficientFundsError, msg
     return True
Exemplo n.º 3
0
 def get_max_bet(self, account_id):
     return determine_max_bet(self.get_balance(account_id).balance)
Exemplo n.º 4
0
 def get_max_bet(self, account_id):
     return determine_max_bet(self.get_balance(account_id).balance)