hotfix for bssid_keys

This commit is contained in:
Laura Klünder 2024-12-27 01:40:32 +01:00
parent c069bf41c9
commit 366c9ab5ad

View file

@ -192,12 +192,17 @@ class MeshNodeQuerySet(models.QuerySet):
for node in self._result_cache
if node.last_messages[MeshMessageType.CONFIG_NODE]
}
nodes_by_bssid_keys = frozenset(nodes_by_bssid.keys())
try:
for ranging_beacon in RangingBeacon.objects.filter(Q(wifi_bssid__in=nodes_by_bssid.keys()) |
Q(node_number__in=nodes_by_id.keys())).select_related('space'):
for ranging_beacon in RangingBeacon.objects.filter(
Q(node_number__in=nodes_by_id.keys())
).select_related('space'):
if not (set(ranging_beacon.wifi_bssids) & nodes_by_bssid_keys):
continue
# noinspection PyUnresolvedReferences
with suppress(KeyError):
nodes_by_bssid[ranging_beacon.wifi_bssid]._ranging_beacon = ranging_beacon
for bssid in ranging_beacon.wifi_bssids:
with suppress(KeyError):
nodes_by_bssid[bssid]._ranging_beacon = ranging_beacon
with suppress(KeyError):
nodes_by_id[ranging_beacon.node_number]._ranging_beacon = ranging_beacon
# todo: detect and warn about conflicts