From 4b8bf43c8e9d90c2a8d150e1e9d2ed05cfd7e0a8 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 30 Mar 2022 09:34:09 +0200 Subject: [PATCH 1/3] avoid modify ruleName epl if already unique --- lib/models/rules.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/models/rules.js b/lib/models/rules.js index 15382735..397e0a3e 100644 --- a/lib/models/rules.js +++ b/lib/models/rules.js @@ -91,7 +91,10 @@ function postR2core(rule, callback) { eplRule = {}; if (isTimedRule(rule)) { // Ensure ruleName in EPL text is in unique format: rule.name@service+subservice - rule.text = rule.text.replace(rule.name, myutils.ruleUniqueName(rule)); + const uniqueNameRule = myutils.ruleUniqueName(rule); + if (!rule.text.includes(uniqueNameRule)) { + rule.text = rule.text.replace(rule.name, uniqueNameRule); + } context = { name: myutils.contextNameTimedRule(rule), text: myutils.contextEPLTimedRule(rule) @@ -175,7 +178,10 @@ function putR2core(rules, callback) { if (rule.text) { if (isTimedRule(rule)) { // Ensure ruleName in EPL text is in unique format: rule.name@service+subservice - rule.text = rule.text.replace(rule.name, myutils.ruleUniqueName(rule)); + const uniqueNameRule = myutils.ruleUniqueName(rule); + if (!rule.text.includes(uniqueNameRule)) { + rule.text = rule.text.replace(rule.name, uniqueNameRule); + } rulesAndContexts.push({ name: myutils.contextNameTimedRule(rule), text: myutils.contextEPLTimedRule(rule) From 11f340e247fea81add5d6aa8b5fbaf11c416e961 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 30 Mar 2022 09:35:39 +0200 Subject: [PATCH 2/3] update cnr --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index c1f9ff1c..53b82260 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ +- Fix: avoid modify ruleName epl if already unique - Fix: preselect in ruleWithContext (#630) From 0584e203fcdf86b40e497ba94649ff9b874f92c5 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 30 Mar 2022 10:46:35 +0200 Subject: [PATCH 3/3] Update CHANGES_NEXT_RELEASE --- CHANGES_NEXT_RELEASE | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 53b82260..faeecc9a 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,2 +1 @@ -- Fix: avoid modify ruleName epl if already unique -- Fix: preselect in ruleWithContext (#630) +- Fix: avoid modify ruleName epl if already unique (#654)