@ -1,6 +1,6 @@
const { convertStringToJson } = require ( "./util" ) ;
const { convertStringToJson } = require ( "./util" ) ;
const getAllProcesses = async ( workflow , query = { } ) => {
const getAllProcesses = async ( workflow , query = { } ) => {
const processes = await bpmsDB . bpms _process . findAll ( {
const processes = await bpmsDB . bpms _process . findAll ( {
where : {
where : {
workflowId : workflow . id ,
workflowId : workflow . id ,
@ -43,7 +43,7 @@ function getProcessPaths(data, workflow) {
// console.log("startNodes", startNodes)
// console.log("startNodes", startNodes)
if ( startNodes ? . length === 0 || ! startNodes ) {
if ( startNodes ? . length === 0 || ! startNodes ) {
invalidPathsWithoutEnding . push ( { path : null , data : null , workflow : workflow . id , error : "هیچ پروسسی برای استارت این ورک فلو وجود ندارد" } ) ;
invalidPathsWithoutEnding . push ( { path : null , data : null , workflow : workflow . id , error : "هیچ پروسسی برای استارت این ورک فلو وجود ندارد" } ) ;
return {
return {
allPaths : [ ] ,
allPaths : [ ] ,
subFlowParentIds : [ ] ,
subFlowParentIds : [ ] ,
@ -86,7 +86,7 @@ function getProcessPaths(data, workflow) {
const newMergedData = [ ... mergedData ]
const newMergedData = [ ... mergedData ]
newMergedData . push ( {
newMergedData . push ( {
processId : currentNode . id . toString ( ) ,
processId : currentNode . id . toString ( ) ,
condition : convertStringToJson ( currentNode . conditions )
// condition: convertStringToJson(currentNode.conditions)
} ) ;
} ) ;
@ -119,7 +119,7 @@ function getProcessPaths(data, workflow) {
if ( nextNodes ? . length === 0 ) {
if ( nextNodes ? . length === 0 ) {
if ( isUniquePath ( newPath ) ) {
if ( isUniquePath ( newPath ) ) {
// allPaths.push({path:newPath.map(n => n.id),data:newMergedData});
// allPaths.push({path:newPath.map(n => n.id),data:newMergedData});
invalidPathsWithoutEnding . push ( { path : newPath . map ( n => n . id ) , data : newMergedData , error : "ورک فلو در این مسیر به پایان نرسید" } ) ;
invalidPathsWithoutEnding . push ( { path : newPath . map ( n => n . id ) , data : newMergedData , error : "ورک فلو در این مسیر به پایان نرسید" } ) ;
}
}
return ;
return ;
}
}
@ -182,7 +182,7 @@ function getProcessPathsSubFlow(data, subFlowIdTemp, workflow) {
if ( startNodes ? . length === 0 || ! startNodes ) {
if ( startNodes ? . length === 0 || ! startNodes ) {
// return [];
// return [];
invalidSubPathsWithoutEnding . push ( { path : null , data : null , workflow : workflow . id , subworkflow : subFlowIdTemp , error : "هیچ پروسس استارتی برای این ورک فلو وجود ندارد" } ) ;
invalidSubPathsWithoutEnding . push ( { path : null , data : null , workflow : workflow . id , subworkflow : subFlowIdTemp , error : "هیچ پروسس استارتی برای این ورک فلو وجود ندارد" } ) ;
return {
return {
subTreePath : [ ] ,
subTreePath : [ ] ,
invalidSubPathsWithoutEnding
invalidSubPathsWithoutEnding
@ -223,7 +223,7 @@ function getProcessPathsSubFlow(data, subFlowIdTemp, workflow) {
const newMergedData = [ ... mergedData ]
const newMergedData = [ ... mergedData ]
newMergedData . push ( {
newMergedData . push ( {
processId : currentNode . id . toString ( ) ,
processId : currentNode . id . toString ( ) ,
condition : convertStringToJson ( currentNode . conditions )
// condition: convertStringToJson(currentNode.conditions)
} ) ;
} ) ;
@ -232,7 +232,12 @@ function getProcessPathsSubFlow(data, subFlowIdTemp, workflow) {
) {
) {
// allPaths.push(newPath.map(n => n.id));
// allPaths.push(newPath.map(n => n.id));
if ( isUniquePath ( newPath ) ) {
if ( isUniquePath ( newPath ) ) {
subTreePath . push ( { path : newPath . map ( n => n . id ) . join ( "," ) , data : newMergedData } ) ;
subTreePath . push (
{
path : newPath . map ( n => n . id ) . join ( "," ) ,
// data: newMergedData
}
) ;
}
}
// console.timeEnd(date);
// console.timeEnd(date);
return ;
return ;
@ -259,7 +264,13 @@ function getProcessPathsSubFlow(data, subFlowIdTemp, workflow) {
if ( isUniquePath ( newPath ) ) {
if ( isUniquePath ( newPath ) ) {
// allPaths.push({path:newPath.map(n => n.id),data:newMergedData});
// allPaths.push({path:newPath.map(n => n.id),data:newMergedData});
invalidSubPathsWithoutEnding . push ( { path : newPath . map ( n => n . id ) , data : newMergedData , error : "هیچ پروسس پایانی برای این ورک فلو وجود ندارد" } ) ;
invalidSubPathsWithoutEnding . push (
{
path : newPath . map ( n => n . id ) ,
// data: newMergedData,
error : "هیچ پروسس پایانی برای این ورک فلو وجود ندارد"
}
) ;
}
}
return ;
return ;
}
}