previous_payment now a list
[utils.git] / src / budget_sync / budget_graph.py
index dccf4e28deb53dc96b394562d916c30c57eb74a5..a6de7a734feb17e5e9cdf27687986d5db5774097 100644 (file)
@@ -511,6 +511,10 @@ class BudgetGraph:
             if node.parent is None:
                 continue
             node.parent.immediate_children.add(node)
+        # useful debug prints
+        #for bug in bugs:
+        #    node = self.nodes[bug.id]
+        #    print ("bug added", bug.id, node, node.parent.immediate_children)
 
     @cached_property
     def roots(self) -> Set[Node]:
@@ -564,9 +568,14 @@ class BudgetGraph:
             errors.append(BudgetGraphNegativeMoney(
                 node.bug.id, root.bug.id))
 
+        childlist = []
         subtasks_total = Money(0)
         for child in node.immediate_children:
             subtasks_total += child.fixed_budget_including_subtasks
+            childlist.append(child.bug.id)
+        # useful debug prints
+        #print ("subtask total", node.bug.id, root.bug.id, subtasks_total,
+        #                        childlist)
 
         payees_total = Money(0)
         payee_payments = {}
@@ -580,11 +589,13 @@ class BudgetGraph:
                 payment.payee
                 previous_payment = payee_payments.get(payment.payee)
                 if previous_payment is not None:
-                    errors.append(BudgetGraphDuplicatePayeesForTask(
-                        node.bug.id, root.bug.id,
-                        previous_payment.payee_key, payment.payee_key
-                    ))
-                payee_payments[payment.payee] = payment
+                    # NOT AN ERROR
+                    print ("NOT AN ERROR", BudgetGraphDuplicatePayeesForTask(
+                           node.bug.id, root.bug.id,
+                           previous_payment[-1].payee_key, payment.payee_key))
+                    payee_payments[payment.payee].append(payment)
+                else:
+                    payee_payments[payment.payee] = [payment]
             except BudgetGraphBaseError as e:
                 errors.append(e)