mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: rule with 'any' condition does not take effect when condition li… (#6628)
* fix: rule with 'any' condition does not take effect when condition list is empty * fix: bug
This commit is contained in:
parent
46227c877f
commit
aa59e0131f
@ -96,7 +96,6 @@ export const conditionAnalyses = async (
|
||||
) => {
|
||||
const type = Object.keys(ruleGroup)[0] || '$and';
|
||||
const conditions = ruleGroup[type];
|
||||
|
||||
let results = conditions.map(async (condition) => {
|
||||
if ('$and' in condition || '$or' in condition) {
|
||||
return await conditionAnalyses({ ruleGroup: condition, variables, localVariables }, jsonLogic);
|
||||
@ -147,8 +146,11 @@ export const conditionAnalyses = async (
|
||||
if (type === '$and') {
|
||||
return every(results, (v) => v);
|
||||
} else {
|
||||
if (results.length) {
|
||||
return some(results, (v) => v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user