Skip to content

Commit 6671ace

Browse files
authored
Merge pull request #161 from mercedes-benz/VULCAN-1004/TableActionRules
fix: rule evaluator bug
2 parents b760424 + 26150cf commit 6671ace

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/extensions/styling/StyleRuleEvaluator.ts

+10-16
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,20 @@ export const evaluateRulesOnDict = (dict, rules, customizations) => {
6363
}
6464
for (const [index, rule] of rules.entries()) {
6565
// Only check customizations that are specified
66-
return evaluateSingleRuleOnDict (dict, rule, index, customizations)
67-
}
68-
// If no rules are met, return not found (index=-1)
69-
return -1;
70-
};
71-
72-
export const evaluateSingleRuleOnDict = (dict, rule, ruleIndex, customizations) => {
73-
if (customizations.includes(rule.customization)) {
74-
// if the row contains the specified field...
75-
if (dict[rule.field] !== undefined && dict[rule.field] !== null) {
76-
const realValue = dict[rule.field].low ? dict[rule.field].low : dict[rule.field];
77-
const ruleValue = rule.value;
78-
if (evaluateCondition(realValue, rule.condition, ruleValue)) {
79-
return ruleIndex;
66+
if (customizations.includes(rule.customization)) {
67+
// if the row contains the specified field...
68+
if (dict[rule.field] !== undefined && dict[rule.field] !== null) {
69+
const realValue = dict[rule.field].low ? dict[rule.field].low : dict[rule.field];
70+
const ruleValue = rule.value;
71+
if (evaluateCondition(realValue, rule.condition, ruleValue)) {
72+
return index;
73+
}
8074
}
8175
}
8276
}
77+
// If no rules are met, return not found (index=-1)
8378
return -1;
84-
}
85-
79+
};
8680

8781
/**
8882
* Evaluates the specified rule set on a node object returned by the Neo4j driver.

0 commit comments

Comments
 (0)