Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/avoid modify rule name epl if already unique (master) #653

Merged
merged 3 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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