From 73c0cbc0d2bef549e7dd71cf453bd76aab769bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sat, 28 Dec 2024 23:48:51 +0100 Subject: [PATCH] fix the thing with the sum? --- src/c3nav/routing/locator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c3nav/routing/locator.py b/src/c3nav/routing/locator.py index 436a9b0c..63b97d7b 100644 --- a/src/c3nav/routing/locator.py +++ b/src/c3nav/routing/locator.py @@ -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]: