Skip to content

Commit

Permalink
0.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
EnhancedJax committed Dec 14, 2024
1 parent f469040 commit c486e16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.13

- Fix: Income record split value should be subtracted, not added, to the account balance

## 0.1.12

- Added total amount in persons view
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "Bagels"
version = "0.1.12"
version = "0.1.13"
authors = [
{ name = "Jax", email = "[email protected]" }
]
Expand Down
10 changes: 8 additions & 2 deletions src/bagels/managers/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def get_account_balance(accountId, session=None):
try:
# Initialize balance
balance = (
session.query(Account).filter(Account.id == accountId).first().beginningBalance
session.query(Account)
.filter(Account.id == accountId)
.first()
.beginningBalance
)

# Get all records for this account
Expand Down Expand Up @@ -66,7 +69,10 @@ def get_account_balance(accountId, session=None):
# Add paid splits (they represent money coming into this account)
for split in splits:
if split.isPaid:
balance += split.amount
if split.record.isIncome:
balance -= split.amount
else:
balance += split.amount

return round(balance, 2)
finally:
Expand Down

0 comments on commit c486e16

Please sign in to comment.