From 56b727a245edef5b87ad1c1bd95b133a88c88e9b Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 11 Sep 2024 15:00:39 +0100 Subject: [PATCH] uneeded boolean --- packages/server/src/threads/automation.ts | 30 +++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index fbb905307e..64ff392a8f 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -463,11 +463,11 @@ class Orchestrator { } private async executeBranchStep(branchStep: BranchStep): Promise { const { branches, children } = branchStep.inputs - const conditionMet = false + for (const branch of branches) { const condition = await this.evaluateBranchCondition(branch.condition) if (condition) { - let branchStatus = { + const branchStatus = { status: `${branch.name} branch taken`, success: true, } @@ -482,22 +482,20 @@ class Orchestrator { const branchSteps = children?.[branch.name] || [] await this.executeSteps(branchSteps) - break + return } } - if (!conditionMet) { - this.stopped = true - this.updateExecutionOutput( - branchStep.id, - branchStep.stepId, - branchStep.inputs, - { - success: false, - status: AutomationStatus.NO_CONDITION_MET, - } - ) - return - } + + this.stopped = true + this.updateExecutionOutput( + branchStep.id, + branchStep.stepId, + branchStep.inputs, + { + success: false, + status: AutomationStatus.NO_CONDITION_MET, + } + ) } private async evaluateBranchCondition(