Merge pull request #745 from arnaudgelas/fix/investment

Even if you set an investment, the default investment shows in the log
This commit is contained in:
geekan 2024-01-15 13:29:58 +08:00 committed by GitHub
commit d1166e97b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,11 +83,12 @@ class Team(BaseModel):
"""Invest company. raise NoMoneyException when exceed max_budget."""
self.investment = investment
CONFIG.max_budget = investment
CONFIG.cost_manager.max_budget = investment
logger.info(f"Investment: ${investment}.")
@staticmethod
def _check_balance():
if CONFIG.cost_manager.total_cost > CONFIG.cost_manager.max_budget:
if CONFIG.cost_manager.total_cost >= CONFIG.cost_manager.max_budget:
raise NoMoneyException(
CONFIG.cost_manager.total_cost, f"Insufficient funds: {CONFIG.cost_manager.max_budget}"
)