Extend SelfServeConditionRules with support for nested evaluation of IS_TRUE_OR_ANY_TRUE and IS_FALSE_OR_ANY_FALSE rule types
This commit is contained in:
@@ -121,6 +121,13 @@ const evaluateCondition = (conditionId, visited = new Set()) => {
|
||||
const conditionRules = rules.value.filter(r => parseInt(r.condition_id) === parseInt(conditionId));
|
||||
if (conditionRules.length === 0) return true;
|
||||
|
||||
if (conditionRules.some(r => r.type === 'IS_TRUE_OR_ANY_TRUE')) {
|
||||
return conditionRules.some(rule => evaluateRule(rule, newVisited));
|
||||
}
|
||||
if (conditionRules.some(r => r.type === 'IS_FALSE_OR_ANY_FALSE')) {
|
||||
return conditionRules.some(rule => rule.type === 'IS_FALSE_OR_ANY_FALSE' ? evaluateRule(rule, newVisited) : !evaluateRule(rule, newVisited));
|
||||
}
|
||||
|
||||
return conditionRules.every(rule => evaluateRule(rule, newVisited));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user