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.
This commit is contained in:
parent
f7b681e8f7
commit
aff602e7dd
1 changed files with 2 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue