fix: handle nil site in list_neighbors_with_equipment

Fixes BadMapError when loading device show page for devices without
an assigned site. Changed to use device.organization_id directly
instead of device.site.organization_id since site can be nil but
organization is always present.
This commit is contained in:
Graham McIntire 2026-02-04 18:09:36 -06:00
parent c70b385db1
commit 8e0fad599e
No known key found for this signature in database

View file

@ -399,7 +399,7 @@ defmodule Towerops.Snmp do
device = Towerops.Devices.get_device!(device_id)
Enum.map(neighbors, fn neighbor ->
matched_device = find_matching_equipment(neighbor, device.site.organization_id)
matched_device = find_matching_equipment(neighbor, device.organization_id)
Map.put(neighbor, :matched_device, matched_device)
end)
end