fix the thing with the sum?

This commit is contained in:
Laura Klünder 2024-12-28 23:48:51 +01:00
parent 41d8158218
commit 73c0cbc0d2

View file

@ -246,7 +246,9 @@ class Locator:
(peer_id, value) for peer_id, value in scan_data_we_can_use if self.peers[peer_id].space_id == space_id
], key=lambda a: -a[1].rssi)
if len(scan_data_in_the_same_room) == 1:
the_sum = sum((value.rssi + 90) for peer_id, value in scan_data_in_the_same_room[:3])
if len(scan_data_in_the_same_room) == 1 or not the_sum:
point = space.point
return CustomLocation(
level=router.levels[space.level_id],
@ -256,8 +258,6 @@ class Locator:
icon='my_location'
)
else:
the_sum = sum((value.rssi+90) for peer_id, value in scan_data_in_the_same_room[:3])
x = 0
y = 0
for peer_id, value in scan_data_in_the_same_room[:3]: