diff --git a/changedetectionio/conditions/__init__.py b/changedetectionio/conditions/__init__.py index 7130d92e..42b8de70 100644 --- a/changedetectionio/conditions/__init__.py +++ b/changedetectionio/conditions/__init__.py @@ -19,7 +19,7 @@ operator_choices = [ ("!in", "Does Not Contain"), ("contains_regex", "Text Matches Regex"), ("!contains_regex", "Text Does NOT Match Regex"), - ("changed > minutes", "Changed more than X minutes ago"), +# ("changed > minutes", "Changed more than X minutes ago"), ] # Fields available in the rules diff --git a/changedetectionio/conditions/form.py b/changedetectionio/conditions/form.py index e57da545..8ff6f986 100644 --- a/changedetectionio/conditions/form.py +++ b/changedetectionio/conditions/form.py @@ -27,16 +27,18 @@ class ConditionFormRow(Form): return False # Custom validation logic - if not self.operator.data or self.operator.data == 'None': - self.operator.errors.append("Operator is required.") - return False + # If any of the operator/field/value is set, then they must be all set + if any(value not in ("", False, "None", None) for value in [self.operator.data, self.field.data, self.value.data]): + if not self.operator.data or self.operator.data == 'None': + self.operator.errors.append("Operator is required.") + return False - if not self.field.data or self.field.data == 'None': - self.field.errors.append("Field is required.") - return False + if not self.field.data or self.field.data == 'None': + self.field.errors.append("Field is required.") + return False - if not self.value.data: - self.value.errors.append("Value is required.") - return False + if not self.value.data: + self.value.errors.append("Value is required.") + return False return True # Only return True if all conditions pass \ No newline at end of file