ady624 / CoRE

CoRE - Community's own Rule Engine
GNU General Public License v3.0
222 stars 663 forks source link

Deleted conditions increment trigger/condition number #44

Open holycacao opened 8 years ago

holycacao commented 8 years ago

if you add an 'If...' condition, then remove it by unselecting the capability, the trigger number still increments, so future 'If...' conditions for the same piston skip numbers. im not sure if this also implies a data leak ie the condition is not being removed from the st database?

phone: iphone 6+ ios: 9.3.4 hub type: hub v2.0, rev e, us hub firmware: 000.015.00003 core: v0.2.13c.20160814

ady624 commented 8 years ago

This behavior is intentional. I would not call it a "leak", but yeah, settings will remain for the deleted condition (I cannot modify the settings variable). The reason for this is pretty simple. If you create an IF with individual actions but then later delete it, and create a new one that would have the same id, you'd inherit everything you deleted on the previous condition which may be contradictory with what you're trying to do. i.e. actions would be pre-populated for a new condition that you wanted empty... Once an id is used, it is not recycled.

holycacao commented 8 years ago

why can you not modify the settings variable (sorry, don't know enough about st development yet)? also, seeing Trigger #1 followed by Trigger #5 can be confusing to the user. why not use separate ids for backend and ui display, so users will always see their triggers in consecutive order?

ady624 commented 8 years ago

the Settings part of things is read only to the SmartApp. I could implement a second list of IDs but they would change as you modify things. They would get renumbered all the time.