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

Rule-Priority (Problem with sort sequence by overwriting the getPriority()-method) #57

Closed
JurMarky opened this issue Nov 16, 2016 · 1 comment
Labels
Milestone

Comments

@JurMarky
Copy link

JurMarky commented Nov 16, 2016

Hi,
you wrote in your documentation:

If you decided to extend the BasicRule class, you can specify rule priority at construction time or by overriding the getPriority() method

Setting the priority via constructor achieves a correct order of my rules. great!
if I extend from BasicRule.class and overwrite the getPriority()-method only and using the default-constructor fo the concrete class, in case of sorting the value that is returned by this method is always compared against DEFAULT_RULE_PRIORITY-value. So the order doesn't depend on the specified priority.
I think the problem is the compareTo-implementation in the BasicRule.class

maybe
if (priority < rule.getPriority()) {
should better be
if (getPriority() < rule.getPriority()) {

} else if (priority > rule.getPriority()) {
should better be
} else if (getPriority() > rule.getPriority()) {

for me extending the BasicRule.class with the current implementation and overwriting the getPriority()-method in the concrete class doesn't achieve a correct sort sequence?!

@fmbenhassine
Copy link
Member

Hi, thank you for reporting this issue.
Yes, this is probably a bug in Easy Rules.

I think your suggestion to use getPriority() method would work.
Can you open a PR with the corresponding test?

Many thanks upfront!
Kind regards
Mahmoud

JurMarky pushed a commit to JurMarky/easyrules that referenced this issue Nov 17, 2016
JurMarky pushed a commit to JurMarky/easyrules that referenced this issue Nov 22, 2016
JurMarky pushed a commit to JurMarky/easyrules that referenced this issue Nov 22, 2016
fmbenhassine added a commit that referenced this issue Nov 23, 2016
@fmbenhassine fmbenhassine added this to the 2.4 milestone Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants