json-rules-engine icon indicating copy to clipboard operation
json-rules-engine copied to clipboard

Inclue RHS factResult after condition evaluation

Open antpingelli opened this issue 4 years ago • 2 comments

We are using the functionality to allow the LHS attribute to be compared to a RHS attribute (demonstrated in this example) but noticed that in the rule result, only the LHS factResult is included. Would it be possible to also include the RHS factResult? I am not too familiar with the code but it seems like the logic is contained below

https://github.com/CacheControl/json-rules-engine/blob/90272d61ed7bea8b7d4000305511e932490d2e2e/src/rule.js#L207-L212

and a logic statement along the lines of if (condition.value is an object) condition.value.factResult = evaluationResult.rightHandSideValue could be added?

If there are no issues with this I am happy to open a PR

antpingelli avatar Sep 16 '21 18:09 antpingelli

@antpingelli This would be helpful in my use case as well.

MattCopenhaver avatar Sep 20 '21 18:09 MattCopenhaver

I would like this feature as well. @CacheControl any thoughts here ?

naveen-shetty avatar Oct 08 '21 21:10 naveen-shetty