From: Jacob Lifshay Date: Mon, 20 Jun 2022 04:34:23 +0000 (-0700) Subject: display submitted/paid totals in tree output X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=472bb09fbac4e41667cedbb9c14869e0b106d9f1;p=utils.git display submitted/paid totals in tree output --- diff --git a/src/budget_sync/budget_graph.py b/src/budget_sync/budget_graph.py index 1577a4b..d0ce97e 100644 --- a/src/budget_sync/budget_graph.py +++ b/src/budget_sync/budget_graph.py @@ -407,6 +407,20 @@ class Node: retval += payment.amount return retval + @cached_property + def submitted_including_subtasks(self) -> Money: + retval = self.submitted_excluding_subtasks + for i in self.immediate_children: + retval += i.submitted_including_subtasks + return retval + + @cached_property + def paid_including_subtasks(self) -> Money: + retval = self.paid_excluding_subtasks + for i in self.immediate_children: + retval += i.paid_including_subtasks + return retval + @property def parent(self) -> Optional["Node"]: if self.parent_id is not None: diff --git a/src/budget_sync/main.py b/src/budget_sync/main.py index e2e39d7..f34a22b 100644 --- a/src/budget_sync/main.py +++ b/src/budget_sync/main.py @@ -53,11 +53,14 @@ def print_budget_then_children(indent, nodes, bug_id): """ bug = nodes[bug_id] - print("bug #%5d %s budget %7s excltasks %7s" % + print("bug #%5d %sbudget %5s excltasks %5s sub_tot %s paid_tot %s" % (bug.bug.id, ' ' * (indent*4), - str(bug.budget_including_subtasks), - str(bug.budget_excluding_subtasks))) - #print (repr(bug)) + str(bug.fixed_budget_including_subtasks), + str(bug.fixed_budget_excluding_subtasks), + str(bug.submitted_including_subtasks), + str(bug.paid_including_subtasks))) + + # print(repr(bug)) for child in bug.immediate_children: if (str(child.budget_including_subtasks) == "0" and str(child.budget_excluding_subtasks) == "0"):