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.
This commit is contained in:
Brett Smith 2020-08-18 16:45:17 -04:00
parent 5a3ee24589
commit bd33c04932

View file

@ -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",