fix budget excluding subtasks getting "fixed" to be negative
[utils.git] / src / budget_sync / budget_graph.py
index de1bed8c7f9d88f7e70fb97c5bb0cd0eb2ae89ee..1577a4b531463f1dcdebdbeed10c13b918751fb0 100644 (file)
@@ -750,8 +750,10 @@ class BudgetGraph:
                     node.fixed_budget_including_subtasks))
 
         def set_excluding_from_including_and_error():
-            node.fixed_budget_excluding_subtasks = \
-                node.budget_including_subtasks - subtasks_total
+            v = node.budget_including_subtasks - subtasks_total
+            if v < 0:
+                return set_including_from_excluding_and_error()
+            node.fixed_budget_excluding_subtasks = v
             errors.append(
                 BudgetGraphMoneyMismatchForBudgetExcludingSubtasks(
                     node.bug.id, root.bug.id,