Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
madanalogy committed Nov 13, 2023
1 parent a720fdf commit a1157a1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_add(chat_id, text):
update_time, trans_ref = transactions.add(details)
debt_ref = trans_ref.collection("debtors")
for debtor in owed_amounts:
debt_ref.document(debtor).add({"name": debtor, "amount": owed_amounts[debtor]})
debt_ref.add({"name": debtor, "amount": owed_amounts[debtor]})

return "Added successfully! Use /list if you want to see all pending transactions"

Expand Down Expand Up @@ -114,8 +114,15 @@ def run_settle(chat_id, text):
debtors = transaction.collection("debtors")
debts_ptr = debtors.stream()
for debt in debts_ptr:
balances[debt.name] += debt.amount
balances[debt.name] -= debt.amount
print(balances)
creditors = []
debtors = []
for person in balances:
if balances[person] > 0:
creditors.append((person, balances[person]))
elif balances < 0:
debtors.append((person, abs(balances[person])))
return "TODO"


Expand Down

0 comments on commit a1157a1

Please sign in to comment.