diff --git a/CHANGELOG.md b/CHANGELOG.md index 72545e26..d6993bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Change log +## Unreleased +* Fixed bug where if the range or threshold of an alert is zero the alert type validation fails. ## [v2.1.1](https://github.com/simvue-io/client/releases/tag/v2.1.1) - 2025-04-25 * Changed from CO2 Signal to ElectricityMaps * Fixed a number of bugs in how offline mode is handled with emissions diff --git a/simvue/api/objects/alert/fetch.py b/simvue/api/objects/alert/fetch.py index 05cc132d..cf7dae47 100644 --- a/simvue/api/objects/alert/fetch.py +++ b/simvue/api/objects/alert/fetch.py @@ -131,8 +131,9 @@ def get( _id, UserAlert(_read_only=True, identifier=_id, _local=True, **_entry), ) - elif _entry["source"] == "metrics" and _entry.get("alert", {}).get( - "threshold" + elif ( + _entry["source"] == "metrics" + and _entry.get("alert", {}).get("threshold") is not None ): yield ( _id, @@ -140,8 +141,9 @@ def get( _local=True, _read_only=True, identifier=_id, **_entry ), ) - elif _entry["source"] == "metrics" and _entry.get("alert", {}).get( - "range_low" + elif ( + _entry["source"] == "metrics" + and _entry.get("alert", {}).get("range_low") is not None ): yield ( _id,