From 6347bc2d6f2dfc1f1f73e98a76db207a266f2b30 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 7 Jul 2022 16:38:15 +0100 Subject: [PATCH] code-comments and alter headers for mdwn Milestone subtotals --- src/budget_sync/write_budget_markdown.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/budget_sync/write_budget_markdown.py b/src/budget_sync/write_budget_markdown.py index ce2e246..bc0a95c 100644 --- a/src/budget_sync/write_budget_markdown.py +++ b/src/budget_sync/write_budget_markdown.py @@ -169,26 +169,30 @@ def _markdown_for_person(person: Person, write_display_status_chunk(display_status) for payee_state in PayeeState: + # work out headers per status if payee_state == PayeeState.NotYetSubmitted: display_status_header = "\n## Payment not yet submitted\n" - subtotals_header = ("\n#### MoU Milestone subtotals for not " + subtotals_header = ("\nMoU Milestone subtotals for not " "yet submitted payments\n") elif payee_state == PayeeState.Submitted: display_status_header = ("\n## Submitted to NLNet but " "not yet paid\n") - subtotals_header = ("\n#### MoU Milestone subtotals for " + subtotals_header = ("\nMoU Milestone subtotals for " "submitted but not yet paid payments\n") else: assert payee_state == PayeeState.Paid display_status_header = "\n## Paid by NLNet\n" - subtotals_header = ("\n#### MoU Milestone subtotals for paid " + subtotals_header = ("\nMoU Milestone subtotals for paid " "payments\n") + # list all the payments grouped by Grant for milestone, payments_list in payments_dict.items(): milestone_header = f"\n### {milestone.identifier}\n" mou_subtotals: Dict[Optional[Node], Money] = defaultdict(Money) headers = [status_tracking_header, display_status_header, milestone_header] + # write out the payments and also compute the subtotals per + # mou milestone for payment in payments_list: node = payment.node if payment.state == payee_state and node_included(node): @@ -196,6 +200,7 @@ def _markdown_for_person(person: Person, writer.write_node(headers=headers, node=payment.node, payment=payment) headers.append(subtotals_header) + # now display the mou subtotals. really, this should be before for node, subtotal in mou_subtotals.items(): writer.write_node_header(headers, node) if node is None: -- 2.30.2