Skip to content

Commit

Permalink
Merge pull request #165 from mercedes-benz/VULCAN-999/RevertTableMess
Browse files Browse the repository at this point in the history
fixed style evalutor
  • Loading branch information
m-o-n-i-s-h authored Dec 12, 2024
2 parents 6090cf4 + 19af8ff commit 10a434d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@
"webpack": "^5.77.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.3"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
26 changes: 10 additions & 16 deletions src/extensions/styling/StyleRuleEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,20 @@ export const evaluateRulesOnDict = (dict, rules, customizations) => {
}
for (const [index, rule] of rules.entries()) {
// Only check customizations that are specified
return evaluateSingleRuleOnDict (dict, rule, index, customizations)
}
// If no rules are met, return not found (index=-1)
return -1;
};

export const evaluateSingleRuleOnDict = (dict, rule, ruleIndex, customizations) => {
if (customizations.includes(rule.customization)) {
// if the row contains the specified field...
if (dict[rule.field] !== undefined && dict[rule.field] !== null) {
const realValue = dict[rule.field].low ? dict[rule.field].low : dict[rule.field];
const ruleValue = rule.value;
if (evaluateCondition(realValue, rule.condition, ruleValue)) {
return ruleIndex;
if (customizations.includes(rule.customization)) {
// if the row contains the specified field...
if (dict[rule.field] !== undefined && dict[rule.field] !== null) {
const realValue = dict[rule.field].low ? dict[rule.field].low : dict[rule.field];
const ruleValue = rule.value;
if (evaluateCondition(realValue, rule.condition, ruleValue)) {
return index;
}
}
}
}
// If no rules are met, return not found (index=-1)
return -1;
}

};

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

0 comments on commit 10a434d

Please sign in to comment.