Skip to content

Commit

Permalink
Merge pull request #653 from telefonicaid/fix/avoid_modify_ruleName_e…
Browse files Browse the repository at this point in the history
…pl_if_already_unique

Fix/avoid modify rule name epl if already unique
  • Loading branch information
fgalan authored Mar 30, 2022
2 parents 4088e86 + 0584e20 commit 451b509
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Fix: preselect in ruleWithContext (#630)
- Fix: avoid modify ruleName epl if already unique (#654)
10 changes: 8 additions & 2 deletions lib/models/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 451b509

Please sign in to comment.