You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the readme, it states that a rule can have multiple conditions and multiple consequences. In the comments for jools.js, it states that the consequences fire when all conditions evaluate to true. However, this is not the behavior. Instead, if you have multiple conditions in a rule, say 2, and the first evaluates to false and the second evaluates to true, the consequence is fired.
I believe the bug resides in the code block that checks each conditions outcome (lines 46-51). It appears to be checking the variable "outcome" to see if it exists (or if a condition has been applied), but only by means of an "if" statement. I'm assuming this is valid in javascript, and that if the variable is null or undefined, it translates to false. However, the problem is that the conditions themselves return boolean values, which are then stored in the "outcome" variable. So, if there are more than one condition, the outcome after the first condition could be false(as in the scenario I described above). On the second time around, "outcome" is already set to false, and instead of "&&" the returned value of the next condition with the current value of "outcome", it just overwrites "outcome" with whatever the second condition returns(in my scenario it returns "true"). Thus, since "outcome" is now set to "true", the consequence function is fired.
The text was updated successfully, but these errors were encountered:
I believe there is a bug in the jools.js module.
In the readme, it states that a rule can have multiple conditions and multiple consequences. In the comments for jools.js, it states that the consequences fire when all conditions evaluate to true. However, this is not the behavior. Instead, if you have multiple conditions in a rule, say 2, and the first evaluates to false and the second evaluates to true, the consequence is fired.
I believe the bug resides in the code block that checks each conditions outcome (lines 46-51). It appears to be checking the variable "outcome" to see if it exists (or if a condition has been applied), but only by means of an "if" statement. I'm assuming this is valid in javascript, and that if the variable is null or undefined, it translates to false. However, the problem is that the conditions themselves return boolean values, which are then stored in the "outcome" variable. So, if there are more than one condition, the outcome after the first condition could be false(as in the scenario I described above). On the second time around, "outcome" is already set to false, and instead of "&&" the returned value of the next condition with the current value of "outcome", it just overwrites "outcome" with whatever the second condition returns(in my scenario it returns "true"). Thus, since "outcome" is now set to "true", the consequence function is fired.
The text was updated successfully, but these errors were encountered: