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,
errors = bg.get_errors()
self.assertErrorTypesMatches(errors, [
BudgetGraphNegativeMoney,
- BudgetGraphMoneyMismatchForBudgetExcludingSubtasks])
+ BudgetGraphMoneyMismatchForBudgetIncludingSubtasks])
self.assertEqual(errors[0].bug_id, 1)
self.assertEqual(errors[0].root_bug_id, 1)
self.assertEqual(errors[1].bug_id, 1)
self.assertEqual(errors[1].root_bug_id, 1)
- self.assertEqual(errors[1].expected_budget_excluding_subtasks, -10)
+ self.assertEqual(errors[1].expected_budget_including_subtasks, 0)
bg = BudgetGraph([
MockBug(bug_id=1,
cf_budget_parent=None,