Fail gracefully checking balance assertions when account does not exist

This commit is contained in:
RunasSudo 2023-05-28 12:22:31 +10:00
parent 6c2d96e300
commit a8ec41b2f2
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -136,7 +136,7 @@ def balance_assertions():
balancer.apply_transactions([t for t in transactions if t.dt <= assertion.dt]) balancer.apply_transactions([t for t in transactions if t.dt <= assertion.dt])
# TODO: Commodities # TODO: Commodities
if balancer.accounts[assertion.account].quantity == assertion.quantity: if assertion.account in balancer.accounts and balancer.accounts[assertion.account].quantity == assertion.quantity:
assertion_status[assertion] = True assertion_status[assertion] = True
else: else:
assertion_status[assertion] = False assertion_status[assertion] = False