Closed ul closed 1 year ago
If I am reading this right, it is expected behavior. thenFinally
is supposed to fire not only when any match is added or updated, but also if any match is removed. In your test it looks like there is initially one match for the rule, and in the thenFinally
you are updating Player, State
from Acting
to Idle
which will cause the match to be removed, which causes thenFinally
to run again. thenFinally
is mainly meant for creating derived facts and it needs to be able to update the derived fact when one of its values has been removed, like in the AllCharacters
example in the readme.
That makes sense, thank you! cc @alertpotato
This test https://github.com/ul/pararules/blob/thenFinally-double-fire/tests/test4.nim fails with
triggerCount was 2
andtriggerEmptyCount was 1
. Is it a bug or expected behaviour? If it's the latter, would you mind helping me wrap my head around it? Because I'd expect theact
rule to be fired only once.