コード例 #1
0
ファイル: bets.py プロジェクト: umeboshi2/vignewton
 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
コード例 #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
コード例 #3
0
ファイル: accounting.py プロジェクト: umeboshi2/vignewton
 def get_max_bet(self, account_id):
     return determine_max_bet(self.get_balance(account_id).balance)
コード例 #4
0
 def get_max_bet(self, account_id):
     return determine_max_bet(self.get_balance(account_id).balance)