From 19af8ffba67dcd3afbfb8ce16d2866400bf47213 Mon Sep 17 00:00:00 2001 From: Monish Nandakumaran Date: Thu, 12 Dec 2024 11:08:53 +0530 Subject: [PATCH] fixed style evalutor --- package.json | 3 ++- src/extensions/styling/StyleRuleEvaluator.ts | 26 ++++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 6200bb3a3..d65a4a2d4 100644 --- a/package.json +++ b/package.json @@ -144,5 +144,6 @@ "webpack": "^5.77.0", "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.7.3" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/src/extensions/styling/StyleRuleEvaluator.ts b/src/extensions/styling/StyleRuleEvaluator.ts index e8908a9c3..52ca81175 100644 --- a/src/extensions/styling/StyleRuleEvaluator.ts +++ b/src/extensions/styling/StyleRuleEvaluator.ts @@ -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.