Ejemplo n.º 1
0
 def submit_entry(cls, user_id: str, entry: Decimal) -> bool:
     "Submit a new entry for the user in this game"
     now = int(time.time())
     time_remaining = cls._start_time - now + cls._clock
     if time_remaining > 0:
         if Wallets.get_balance(user_id) > Decimal('1'):
             if Wallets.adjust_balance(user_id, Decimal('-1')):
                 cls._entries.append((user_id, entry))
                 Reports.log_event(
                     f"New entry `{entry}` submitted by `{user_id}`")
                 return True
             Reports.log_event(
                 f"Problem adjusting balance for `{user_id}`")
             return False
         Reports.log_event(f"User Balance for `{user_id}` to low")
         return False
     Reports.log_event("Game Closed")
     return False
Ejemplo n.º 2
0
 def get_balance(user_id: str) -> Decimal:
     "Get a players balance"
     return Wallets.get_balance(user_id)