From ba8aaaa98831ee8da9b2c4ff4d0a82683f82f99b Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 9 Jun 2020 14:51:47 -0400 Subject: [PATCH] accrual: Aging report uses group since last nonzero. RT#11600. This makes it consistent with our other reports. The fact that it wasn't already was basically an oversight. --- conservancy_beancount/reports/accrual.py | 6 +++++- setup.py | 2 +- tests/books/accruals.beancount | 18 ++++++++++++++++++ tests/test_reports_accrual.py | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/conservancy_beancount/reports/accrual.py b/conservancy_beancount/reports/accrual.py index 3bd3d8b..57a21bb 100644 --- a/conservancy_beancount/reports/accrual.py +++ b/conservancy_beancount/reports/accrual.py @@ -480,7 +480,11 @@ class AgingReport(BaseReport): self.ods = AgingODS(rt_client, date, self.logger) def run(self, groups: PostGroups) -> None: - rows = list(group for group in groups.values() if not group.is_zero()) + rows = list( + group.since_last_nonzero() + for group in groups.values() + if not group.is_zero() + ) rows.sort(key=lambda related: ( related.account, related[0].meta.date, diff --git a/setup.py b/setup.py index eec26a0..2ce3782 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup setup( name='conservancy_beancount', description="Plugin, library, and reports for reading Conservancy's books", - version='1.1.4', + version='1.1.5', author='Software Freedom Conservancy', author_email='info@sfconservancy.org', license='GNU AGPLv3+', diff --git a/tests/books/accruals.beancount b/tests/books/accruals.beancount index 14ad6b4..e49d039 100644 --- a/tests/books/accruals.beancount +++ b/tests/books/accruals.beancount @@ -24,6 +24,18 @@ Liabilities:Payable:Accounts 125 USD Assets:Checking -125 USD +2010-03-15 * "GrantCo" "2010Q1 grant" + rt-id: "rt:470" + invoice: "rt:470/4700" + Assets:Receivable:Accounts 5000 USD + Income:Donations -5000 USD + +2010-03-25 * "GrantCo" "2010Q1 grant ACH payment" + rt-id: "rt:470" + invoice: "rt:470/4700" + Assets:Receivable:Accounts -5000 USD + Assets:Checking 5000 USD + 2010-03-30 * "EarlyBird" "Travel reimbursement" rt-id: "rt:490" invoice: "rt:490/4900" @@ -115,3 +127,9 @@ contract: "rt:520/5220" Liabilities:Payable:Accounts -1,000 EUR {1.100 USD} Expenses:FilingFees 1,000 EUR {1.100 USD} + +2010-06-15 * "GrantCo" "2010Q2 grant" + rt-id: "rt:470" + invoice: "rt:470/4700" + Assets:Receivable:Accounts 5500 USD + Income:Donations -5500 USD diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index 5ae73db..1ab7901 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -118,6 +118,7 @@ AGING_AR = [ AgingRow.make_simple('2010-03-05', 'EarlyBird', -500, 'rt:40/400'), AgingRow.make_simple('2010-05-15', 'MatchingProgram', 1500, 'rt://ticket/515/attachments/5150'), + AgingRow.make_simple('2010-06-15', 'GrantCo', 5500, 'rt:470/4700'), ] class RTClient(testutil.RTClient):