Skip to content

Commit 4357ea5

Browse files
authored
Fix UnboundLocalError when checking alerts for query (#7346)
This fixes the following exception: ``` UnboundLocalError: local variable 'value_is_number' referenced before assignment File "rq/worker.py", line 1431, in perform_job rv = job.perform() File "rq/job.py", line 1280, in perform self._result = self._execute() File "rq/job.py", line 1317, in _execute result = self.func(*self.args, **self.kwargs) File "redash/tasks/alerts.py", line 36, in check_alerts_for_query new_state = alert.evaluate() File "redash/models/__init__.py", line 1002, in evaluate new_state = next_state(op, value, threshold) File "redash/models/__init__.py", line 928, in next_state elif not value_is_number and op not in [OPERATORS.get("!="), OPERATORS.get("=="), OPERATORS.get("equals")]: ```
1 parent 5df5ca8 commit 4357ea5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

redash/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ def next_state(op, value, threshold):
908908
# boolean value is Python specific and most likely will be confusing to
909909
# users.
910910
value = str(value).lower()
911+
value_is_number = False
911912
else:
912913
try:
913914
value = float(value)

0 commit comments

Comments
 (0)