From aff602e7dd53333fca511b434fc58cf4cea12da9 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 3 Jan 2026 11:09:13 -0600 Subject: [PATCH] Fix active alerts filter to exclude recovery notifications Only equipment_down alerts should be counted as "active alerts that need attention". Equipment_up alerts are informational recovery notifications and don't require action. --- lib/towerops/alerts.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/towerops/alerts.ex b/lib/towerops/alerts.ex index 3e6d6bcc..f43e514b 100644 --- a/lib/towerops/alerts.ex +++ b/lib/towerops/alerts.ex @@ -33,6 +33,7 @@ defmodule Towerops.Alerts do @doc """ Returns the list of active (unresolved) alerts for an organization. + Only returns equipment_down alerts, as equipment_up alerts are informational. """ def list_organization_active_alerts(organization_id) do Repo.all( @@ -40,6 +41,7 @@ defmodule Towerops.Alerts do join: e in assoc(a, :equipment), join: s in assoc(e, :site), where: s.organization_id == ^organization_id, + where: a.alert_type == :equipment_down, where: is_nil(a.resolved_at), order_by: [desc: a.triggered_at], preload: [equipment: {e, site: s}, acknowledged_by: :acknowledged_by]