google / if-this-then-ad

☀️ A game changer in rule-based marketing. Run marketing campaigns based on real world events.
Apache License 2.0
75 stars 13 forks source link

Fixed add-rule datapoint selection again #108

Closed paranerd closed 2 years ago

paranerd commented 2 years ago

Had to issue a re-fix for datapoint selection in "add-rule".

I changed the datapoint types for the Ambee Source Agent back from 'enum' to 'string' in accordance with rule evaluation logic.

In the add-rule.component.html I added another switch case for currentRuleConditionValues && currentRuleConditionValues.length > 0. This will handle any value arrays. Don't know why && currentRuleConditionValues.length wasn't enough, but it didn't work, that's why. I also had to explicitly add && !currentRuleConditionValues to the "string" switch case - otherwise both a dropdown AND an input field would be shown (the cases don't break).

In the add-rule.component.ts onDataPointChange() I reset this.currentRuleConditionValues to undefined - otherwise when switching from an "string-array"-datatype to a "string"-datatype this.currentRuleConditionValues would still be populated and thus the first switch case would be activated. I also set this.lockEquals = true for "string" types since we're not going to use "greater than" or "lower than" for strings.