Skip to content

Commit

Permalink
refactor(statements/safety): add additional safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-awd committed Nov 24, 2024
1 parent 55fbab6 commit c66963f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/monopoly/statements/credit_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def perform_safety_check(self) -> bool:

total_amount_found = total_amount in numbers

# if sum of debit and credit is the same as the total amount
# then the statement is safe
if round(sum(amounts), 2) == total_amount:
return True

# attempt a debit-statement style safety for banks that have
# debit and credit amounts as separate numbers and not a single total sum
if total_amount_found or DebitStatement.perform_safety_check(self):
Expand Down

0 comments on commit c66963f

Please sign in to comment.