diff --git a/index.js b/index.js index 296ee41..5b5dddc 100644 --- a/index.js +++ b/index.js @@ -48,8 +48,8 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); allWorkFlowInfo[workflow.id] = { isValid: invalidPathsWithoutEnding.length == 0 ? true : false, root: { - // validPaths: tree, - // invalidPaths: invalidPathsWithoutEnding, + validPaths: invalidPathsWithoutEnding.length == 0 && tree.length>0?tree: [], + // invalidPaths: invalidPathsWithoutEnding.length == 0?[]:invalidPathsWithoutEnding, valid: tree.length, invalid: invalidPathsWithoutEnding.length, subFlowList: subFlowParentIds @@ -57,8 +57,14 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); subFlow: {} } + if(invalidPathsWithoutEnding.length > 0) { + allWorkFlowInfo[workflow.id].isValid = false; + continue workflowsFor; + } + const subFlowInfo = {} + subFlowFor: for await (const subFlowId of subFlowParentIds) { const processesSubFlow = await getAllProcesses(workflow, { @@ -85,6 +91,9 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); } const { subTreePath, invalidSubPathsWithoutEnding } = await getProcessPathsSubFlow(processesSubFlow, subFlowId, workflow); + if(invalidSubPathsWithoutEnding.length > 0) { + allWorkFlowInfo[workflow.id].isValid = false; + } subFlowInfo[subFlowId] = { valid: subTreePath.length, invalid: invalidSubPathsWithoutEnding.length, @@ -92,10 +101,7 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); // invalidSubTreePath: invalidSubPathsWithoutEnding } } - allWorkFlowInfo[workflow.id]["subFlow"] = subFlowInfo; - - }