Fix subconditions and condition group form #2256
Reference in New Issue
Block a user
Delete Branch "fix-more-rule-stuff"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
These 3 tiny changes took me hours - this was really weird and as a rails/ruby novice I got tripped up on a lot, but it's working now!
There's ultimately a two main bugs fixed by this:
I noticed quite a few things debugging all of this:
0, so it was also saved. This was a result of the top levelrules_controllerdoing a replace_all on theIDX_PLACEHOLDERof both the condition and subcondition template. When the subcondition template was duplicated, it had the unique key from the parent no matter what - resulting in many subconditions having the same index.IDX_PLACEHOLDERon the subcondition toIDX_CHILD_PLACEHOLDER, each subcondition was properly getting the uniquekey from the conditions_controller, but the function there returned an alphanumeric string. After a bunch of chatting with o3, I found out that there seems to be something in rails that makes an alphanumeric key unpermitted. I updated the#uniqueKey()function in the condition controller to match the same function in the rules controller.Here is a video showing some weird behavior before:
https://github.com/user-attachments/assets/fbdfa7fb-e65d-40b7-8526-bfc47d0726f4
and after:
https://github.com/user-attachments/assets/0706b89b-dce5-417d-bdb5-838316152c41
I still think there's some room for improvement on this page - like each rule showing that there is a condition group instead of a single condition from that group, but that's going to be outside of this.
fixes #2247
fixes #2248
fixes #2249
Thanks for tracking this down! Definitely a tricky one!