code-comments and alter headers for mdwn Milestone subtotals
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 7 Jul 2022 15:38:15 +0000 (16:38 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 7 Jul 2022 15:38:15 +0000 (16:38 +0100)
src/budget_sync/write_budget_markdown.py

index ce2e246e7bb27e7b95a69deb97241065d4273c97..bc0a95cce7925608594a66fd020b0f32a4862d97 100644 (file)
@@ -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: