diff --git a/lib/towerops_web/live/alert_live/index.ex b/lib/towerops_web/live/alert_live/index.ex index 92361434..96dac9d9 100644 --- a/lib/towerops_web/live/alert_live/index.ex +++ b/lib/towerops_web/live/alert_live/index.ex @@ -197,7 +197,7 @@ defmodule ToweropsWeb.AlertLive.Index do # Compute counts for filter tabs counts = %{ all: length(all_alerts), - critical: Enum.count(all_alerts, &(&1.alert_type == :device_down and is_nil(&1.resolved_at))), + critical: Enum.count(all_alerts, &(&1.alert_type == "device_down" and is_nil(&1.resolved_at))), unresolved: Enum.count(all_alerts, &is_nil(&1.resolved_at)), resolved: Enum.count(all_alerts, &(not is_nil(&1.resolved_at))) } @@ -212,7 +212,7 @@ defmodule ToweropsWeb.AlertLive.Index do defp filter_alerts(alerts, "all"), do: alerts defp filter_alerts(alerts, "critical"), - do: Enum.filter(alerts, &(&1.alert_type == :device_down and is_nil(&1.resolved_at))) + do: Enum.filter(alerts, &(&1.alert_type == "device_down" and is_nil(&1.resolved_at))) defp filter_alerts(alerts, "unresolved"), do: Enum.filter(alerts, &is_nil(&1.resolved_at)) @@ -236,8 +236,8 @@ defmodule ToweropsWeb.AlertLive.Index do Enum.sort_by(alerts, fn alert -> severity_weight = cond do - alert.alert_type == :device_down and is_nil(alert.resolved_at) -> 0 - alert.alert_type == :device_down -> 1 + alert.alert_type == "device_down" and is_nil(alert.resolved_at) -> 0 + alert.alert_type == "device_down" -> 1 true -> 2 end @@ -256,7 +256,7 @@ defmodule ToweropsWeb.AlertLive.Index do end) |> Enum.map(fn {{site_id, site_name}, site_alerts} -> sub_info = if site_id, do: site_subscribers[site_id] - critical_count = Enum.count(site_alerts, &(&1.alert_type == :device_down and is_nil(&1.resolved_at))) + critical_count = Enum.count(site_alerts, &(&1.alert_type == "device_down" and is_nil(&1.resolved_at))) %{ site_id: site_id, @@ -302,7 +302,7 @@ defmodule ToweropsWeb.AlertLive.Index do alert.resolved_at -> "gray" - alert.alert_type == :device_down and is_nil(alert.resolved_at) -> + alert.alert_type == "device_down" and is_nil(alert.resolved_at) -> age_minutes = DateTime.diff(DateTime.utc_now(), alert.triggered_at, :minute) cond do