Browse Source
Merge pull request #5702 from Budibase/fix/pc-fixes-automations
Account for object in failure condition
pull/5712/head
Peter Clement
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
17 additions and
3 deletions
-
packages/server/src/threads/automation.js
|
|
|
@ -191,7 +191,6 @@ class Orchestrator { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ( |
|
|
|
index === parseInt(env.AUTOMATION_MAX_ITERATIONS) || |
|
|
|
index === loopStep.inputs.iterations |
|
|
|
@ -205,10 +204,25 @@ class Orchestrator { |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
let isFailure = false |
|
|
|
if ( |
|
|
|
this._context.steps[loopStepNumber]?.currentItem === |
|
|
|
loopStep.inputs.failure |
|
|
|
typeof this._context.steps[loopStepNumber]?.currentItem === "object" |
|
|
|
) { |
|
|
|
isFailure = Object.keys( |
|
|
|
this._context.steps[loopStepNumber].currentItem |
|
|
|
).some(value => { |
|
|
|
return ( |
|
|
|
this._context.steps[loopStepNumber].currentItem[value] === |
|
|
|
loopStep.inputs.failure |
|
|
|
) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
isFailure = |
|
|
|
this._context.steps[loopStepNumber]?.currentItem === |
|
|
|
loopStep.inputs.failure |
|
|
|
} |
|
|
|
|
|
|
|
if (isFailure) { |
|
|
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, { |
|
|
|
status: AutomationErrors.FAILURE_CONDITION, |
|
|
|
success: false, |
|
|
|
|