From: Luke Kenneth Casson Leighton Date: Tue, 20 Apr 2021 13:10:27 +0000 (+0100) Subject: improve spacing in mdwn output, add payment date print-out X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7b59646366ad46655fc6fda52425bf9f1dc34df;p=utils.git improve spacing in mdwn output, add payment date print-out --- diff --git a/src/budget_sync/write_budget_markdown.py b/src/budget_sync/write_budget_markdown.py index c72caf2..b04e7fd 100644 --- a/src/budget_sync/write_budget_markdown.py +++ b/src/budget_sync/write_budget_markdown.py @@ -84,6 +84,12 @@ class MarkdownWriter: f" which is €{node.budget_excluding_subtasks})") else: total = f"€{node.fixed_budget_excluding_subtasks}" + if payment.submitted: + print(f" * submitted on {payment.submitted}", + file=self.buffer) + if payment.paid: + print(f" * paid on {payment.paid}", + file=self.buffer) if payment.amount != node.fixed_budget_excluding_subtasks \ or payment.amount != node.budget_excluding_subtasks: print(f" * €{payment.amount} out of total of {total}", @@ -98,9 +104,9 @@ def _markdown_for_person(person: Person, assigned_nodes: List[Node]) -> str: writer = MarkdownWriter() print(f"", file=writer.buffer) - writer.write_headers([f"# {person.identifier}"]) + writer.write_headers([f"\n# {person.identifier}\n"]) print(file=writer.buffer) - status_tracking_header = "# Status Tracking" + status_tracking_header = "\n# Status Tracking\n" writer.write_headers([status_tracking_header]) displayed_nodes_dict: Dict[DisplayStatus, List[Node]] displayed_nodes_dict = {i: [] for i in DisplayStatus} @@ -109,7 +115,7 @@ def _markdown_for_person(person: Person, displayed_nodes_dict[display_status].append(node) def write_display_status_chunk(display_status: DisplayStatus): - display_status_header = f"## {display_status.value}" + display_status_header = f"\n## {display_status.value}\n" for node in displayed_nodes_dict[display_status]: if display_status == DisplayStatus.Completed: payment_found = False @@ -141,8 +147,9 @@ def _markdown_for_person(person: Person, else: assert payee_state == PayeeState.Paid display_status_header = f"## Paid by NLNet" + display_status_header="\n%s\n" % display_status_header for milestone, payments_list in payments_dict.items(): - milestone_header = f"### {milestone.identifier}" + milestone_header = f"\n### {milestone.identifier}\n" for payment in payments_list: if payment.state == payee_state: writer.write_node(headers=[status_tracking_header,