From bd33c049327dc7623a3f6bcad545770afd3f8120 Mon Sep 17 00:00:00 2001 From: Brett Smith <brettcsmith@brettcsmith.org> Date: Tue, 18 Aug 2020 16:45:17 -0400 Subject: [PATCH] balance_sheet: Re-simplify the "release from restrictions" math. Basically the original bug was an incorrect sign. The last implementation was very belt-and-suspenders to help me think through it. But it's also more error-prone in the long run. --- conservancy_beancount/reports/balance_sheet.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/conservancy_beancount/reports/balance_sheet.py b/conservancy_beancount/reports/balance_sheet.py index 16f3513..1ca21db 100644 --- a/conservancy_beancount/reports/balance_sheet.py +++ b/conservancy_beancount/reports/balance_sheet.py @@ -433,16 +433,14 @@ class Report(core.BaseODS[Sequence[None], None]): self.add_row( self.string_cell("Net Assets released from restrictions:"), ) - released_expenses = self.balances.total( + released = self.balances.total( account='Expenses', period=Period.PERIOD, fund=Fund.RESTRICTED, - ) - other_totals = [core.MutableBalance() for _ in bal_kwargs] - other_totals[0] += released_expenses - self.balances.total( + ) - self.balances.total( classification=self.C_SATISFIED, period=Period.PERIOD, fund=Fund.UNRESTRICTED, ) - other_totals[1] -= released_expenses + self.balances.total( - classification=self.C_SATISFIED, period=Period.PERIOD, fund=Fund.RESTRICTED, - ) + other_totals = [core.MutableBalance() for _ in bal_kwargs] + other_totals[0] += released + other_totals[1] -= released self.write_totals_row(self.C_SATISFIED, other_totals) self.write_totals_row( "Total Support and Revenue",