fix: Adjust variables with successful step executions
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
import Context from '../../types/express/context';
|
import Context from '../../types/express/context';
|
||||||
|
import ExecutionStep from '../../models/execution-step';
|
||||||
|
import { ref } from 'objection';
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
stepId: string;
|
stepId: string;
|
||||||
@@ -16,12 +18,17 @@ const getStepWithTestExecutions = async (
|
|||||||
|
|
||||||
const previousStepsWithCurrentStep = await context.currentUser
|
const previousStepsWithCurrentStep = await context.currentUser
|
||||||
.$relatedQuery('steps')
|
.$relatedQuery('steps')
|
||||||
.withGraphFetched('executionSteps')
|
.withGraphJoined('executionSteps')
|
||||||
.modifyGraph('executionSteps', (builder) => {
|
|
||||||
builder.orderBy('created_at', 'desc').limit(1);
|
|
||||||
})
|
|
||||||
.where('flow_id', '=', step.flowId)
|
.where('flow_id', '=', step.flowId)
|
||||||
.andWhere('position', '<', step.position)
|
.andWhere('position', '<', step.position)
|
||||||
|
.andWhere(
|
||||||
|
'executionSteps.created_at',
|
||||||
|
'=',
|
||||||
|
ExecutionStep.query()
|
||||||
|
.max('created_at')
|
||||||
|
.where('step_id', '=', ref('steps.id'))
|
||||||
|
.andWhere('status', 'success')
|
||||||
|
)
|
||||||
.orderBy('steps.position', 'asc');
|
.orderBy('steps.position', 'asc');
|
||||||
|
|
||||||
return previousStepsWithCurrentStep;
|
return previousStepsWithCurrentStep;
|
||||||
|
Reference in New Issue
Block a user