Skip to content

Commit

Permalink
Handle split txns in processExpense
Browse files Browse the repository at this point in the history
  • Loading branch information
Sha-yol committed Dec 3, 2024
1 parent 1633656 commit 6195e94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,16 @@ def processExpense(past_day: datetime, txns: dict[dict], exp: Expense, *args) ->
"""

strategy = get_transaction_strategy()
new_txns: list[dict] = strategy.create_transactions(exp, *args)
new_txns: list = strategy.create_transactions(exp, *args)
for idx, new_txn in enumerate(new_txns):
external_url = getSWUrlForExpense(exp)
if idx > 0:
external_url += f"-balance_transfer-{idx}"
new_txn["external_url"] = external_url
if isinstance(new_txn, dict):
new_txn["external_url"] = external_url
else:
for split in new_txn:
split["external_url"] = external_url

if oldTxnBody := txns.get(external_url):
print(f"Updating transaction {idx + 1}...")
Expand Down

0 comments on commit 6195e94

Please sign in to comment.