mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:40:50 +00:00
fix(plugin-workflow-loop): fix condition checking (#5634)
This commit is contained in:
parent
e42c480d85
commit
3f86115f84
@ -111,23 +111,21 @@ export default class extends Instruction {
|
||||
job.set({ result: { looped: nextIndex } });
|
||||
await processor.saveJob(job);
|
||||
|
||||
if (loop.config.condition) {
|
||||
const { calculation, expression, continueOnFalse } = loop.config.condition ?? {};
|
||||
if (calculation || expression) {
|
||||
const condition = calculateCondition(loop, processor);
|
||||
if (!condition && !continueOnFalse) {
|
||||
job.set({
|
||||
status: JOB_STATUS.RESOLVED,
|
||||
result: { looped: nextIndex, broken: true },
|
||||
});
|
||||
return job;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const length = getTargetLength(target);
|
||||
if (nextIndex < length) {
|
||||
await processor.saveJob(job);
|
||||
if (loop.config.condition) {
|
||||
const { calculation, expression, continueOnFalse } = loop.config.condition ?? {};
|
||||
if (calculation || expression) {
|
||||
const condition = calculateCondition(loop, processor);
|
||||
if (!condition && !continueOnFalse) {
|
||||
job.set({
|
||||
status: JOB_STATUS.RESOLVED,
|
||||
result: { looped: nextIndex, broken: true },
|
||||
});
|
||||
return job;
|
||||
}
|
||||
}
|
||||
}
|
||||
await processor.run(branch, job);
|
||||
return processor.exit();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user