Skip to content

Commit 868e492

Browse files
authored
Merge pull request #813 from simvue-io/kzscisoft/hotfix-zero-range-values
🐛 Fixed bug when threshold or alert range of zero specified
2 parents c397368 + 40d5644 commit 868e492

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Change log
2+
## Unreleased
3+
* Fixed bug where if the range or threshold of an alert is zero the alert type validation fails.
24
## [v2.1.1](https://github.com/simvue-io/client/releases/tag/v2.1.1) - 2025-04-25
35
* Changed from CO2 Signal to ElectricityMaps
46
* Fixed a number of bugs in how offline mode is handled with emissions

simvue/api/objects/alert/fetch.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,19 @@ def get(
131131
_id,
132132
UserAlert(_read_only=True, identifier=_id, _local=True, **_entry),
133133
)
134-
elif _entry["source"] == "metrics" and _entry.get("alert", {}).get(
135-
"threshold"
134+
elif (
135+
_entry["source"] == "metrics"
136+
and _entry.get("alert", {}).get("threshold") is not None
136137
):
137138
yield (
138139
_id,
139140
MetricsThresholdAlert(
140141
_local=True, _read_only=True, identifier=_id, **_entry
141142
),
142143
)
143-
elif _entry["source"] == "metrics" and _entry.get("alert", {}).get(
144-
"range_low"
144+
elif (
145+
_entry["source"] == "metrics"
146+
and _entry.get("alert", {}).get("range_low") is not None
145147
):
146148
yield (
147149
_id,

0 commit comments

Comments
 (0)