display submitted/paid totals in tree output
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 20 Jun 2022 04:34:23 +0000 (21:34 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Mon, 20 Jun 2022 04:34:23 +0000 (21:34 -0700)
src/budget_sync/budget_graph.py
src/budget_sync/main.py

index 1577a4b531463f1dcdebdbeed10c13b918751fb0..d0ce97eacfee13e1bef23c17bfc0d0a719fd8a75 100644 (file)
@@ -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:
index e2e39d7280ec8e44f19072333ef9d43c1186d37e..f34a22b6c3cd7db5fead530492e4ff1403eabd90 100644 (file)
@@ -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"):