From 3fa1c81c4a791c8f1889a5f1d3e4b03dcfb73cc6 Mon Sep 17 00:00:00 2001 From: MohammadHoseinPaymard Date: Mon, 26 May 2025 16:55:52 +0330 Subject: [PATCH] update index.js and process.js --- index.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index f31e660..b309e1f 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,9 @@ const path = require('path'); +const fs = require('fs'); + const { sleep } = require('./util'); const { getAllWorkflows } = require('./workflow'); -const { getAllProcesses, getProcessPaths } = require('./process'); +const { getAllProcesses, getProcessPaths, getProcessPathsSubFlow } = require('./process'); require(path.join(process.cwd(), "..", "server", "dist", "database.js")); @@ -73,18 +75,29 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); if (processesSubFlow.length == 0) { allWorkFlowInfo[workflow.id].isValid = false; subFlowInfo[subFlowId] = { - valid: subTreePath.length, - invalid: invalidSubPathsWithoutEnding.length, - validSubTreePath:subTreePath, - invalidSubTreePath: invalidSubPathsWithoutEnding + valid: 0, + invalid: 0, + validSubTreePath: [], + invalidSubTreePath: [], + error: "این ورک فلو ساب آیدی ، هیچ زیرمجموعه ای ندارد" } continue subFlowFor; } + + const { subTreePath, invalidSubPathsWithoutEnding } = await getProcessPathsSubFlow(processesSubFlow, subFlowId, workflow); + subFlowInfo[subFlowId] = { + valid: subTreePath.length, + invalid: invalidSubPathsWithoutEnding.length, + validSubTreePath: subTreePath, + invalidSubTreePath: invalidSubPathsWithoutEnding + } } allWorkFlowInfo[workflow.id]["subFlow"] = subFlowInfo; - console.log("allWorkFlowInfo",JSON.stringify(allWorkFlowInfo,null,2)); + console.log("allWorkFlowInfo", JSON.stringify(allWorkFlowInfo, null, 2)); + fs.writeFileSync("./result-pretty.json",JSON.stringify(allWorkFlowInfo,null,2)); + } console.timeEnd("WorkflowTester")