Skip to content

Commit

Permalink
fix(transaction): avoid negative zero value
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-awd committed Sep 8, 2024
1 parent 8625a27 commit 5a626c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/monopoly/statements/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def convert_credit_amount_to_negative(self: "Transaction") -> "Transaction":
"""
Converts transactions with a suffix of "CR" or "+" to positive
"""
# avoid negative zero
if self.amount == 0:
return self

if self.suffix in ("CR", "+"):
self.amount = abs(self.amount)

Expand Down

0 comments on commit 5a626c2

Please sign in to comment.