Skip to content

Commit dfba1dc

Browse files
authored
Merge pull request #162 from mercedes-benz/revert-161-VULCAN-1004/TableActionRules
Revert "fix: rule evaluator bug"
2 parents 6671ace + 14e1ec4 commit dfba1dc

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/extensions/styling/StyleRuleEvaluator.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,27 @@ export const evaluateRulesOnDict = (dict, rules, customizations) => {
6363
}
6464
for (const [index, rule] of rules.entries()) {
6565
// Only check customizations that are specified
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-
}
74-
}
75-
}
66+
return evaluateSingleRuleOnDict (dict, rule, index, customizations)
7667
}
7768
// If no rules are met, return not found (index=-1)
7869
return -1;
7970
};
8071

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;
80+
}
81+
}
82+
}
83+
return -1;
84+
}
85+
86+
8187
/**
8288
* Evaluates the specified rule set on a node object returned by the Neo4j driver.
8389
* @param node - the node representation returned by the Neo4j driver.

0 commit comments

Comments
 (0)