From dd8c97a45f98badd9432bad0061cbe052a37abe6 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 5 Feb 2026 09:16:11 -0600 Subject: [PATCH] fix: handle devices without sites in GraphLive live polling Devices can belong directly to organizations without sites. Fixed perform_live_poll to check device.organization_id instead of device.site.organization_id which caused BadMapError when site is nil. Also removed unused Repo alias. --- lib/towerops_web/live/graph_live/show.ex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/towerops_web/live/graph_live/show.ex b/lib/towerops_web/live/graph_live/show.ex index fa19322e..99c79291 100644 --- a/lib/towerops_web/live/graph_live/show.ex +++ b/lib/towerops_web/live/graph_live/show.ex @@ -4,7 +4,6 @@ defmodule ToweropsWeb.GraphLive.Show do alias Towerops.Devices alias Towerops.Monitoring - alias Towerops.Repo alias Towerops.Snmp # Maximum live data points (5 minutes at 1 second intervals) @@ -631,10 +630,9 @@ defmodule ToweropsWeb.GraphLive.Show do |> push_navigate(to: ~p"/devices") device -> - device = Repo.preload(device, site: :organization) organization = socket.assigns.current_scope.organization - if device.site.organization_id == organization.id do + if device.organization_id == organization.id do poll_and_update_buffer(socket, device) else socket