Changeset - 708d48699ae3
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-07-20 19:13:20
brettcsmith@brettcsmith.org
accrual: Restore "since last nonzero" behavior to outgoing report.

Basically this behavior is an extension of the fact that the outgoing report
is grouped by RT ticket rather than "accrual data." Ripping this
functionality out of other reports was correct, but it needed to stay for
the outgoing report.
3 files changed with 20 insertions and 4 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/accrual.py
Show inline comments
...
 
@@ -541,2 +541,11 @@ class OutgoingReport(BaseReport):
 

	
 
        last_zero_index = -1
 
        for index, (post, balance) in enumerate(posts.iter_with_balance()):
 
            if balance.is_zero():
 
                prior_zero_index = last_zero_index
 
                last_zero_index = index
 
        if last_zero_index == index:
 
            last_zero_index = prior_zero_index
 
        posts = posts[last_zero_index + 1:]
 

	
 
        balance = -posts.balance_at_cost()
setup.py
Show inline comments
...
 
@@ -7,3 +7,3 @@ setup(
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.5.10',
 
    version='1.5.11',
 
    author='Software Freedom Conservancy',
tests/test_reports_accrual.py
Show inline comments
...
 
@@ -512,5 +512,12 @@ def test_outgoing_report(accrual_postings, caplog):
 
        r'^BEANCOUNT ENTRIES:$',
 
        # For each transaction, check for the date line, a metadata, and the
 
        # Expenses posting.
 
        r'^\s*2010-06-10\s',
 
    ])
 
    # Find the date line of the first transaction.
 
    # For each transaction, check for the date line, a metadata, and the
 
    # Expenses posting.
 
    for line in output:
 
        if not line.isspace():
 
            break
 
    assert re.match(r'\s*2010-06-10\s', line), \
 
        "first entry line did not have expected date"
 
    check_output(output, [
 
        fr'^\s+rt-id: "{rt_id_url}"$',
0 comments (0 inline, 0 general)