From 7cc097380036ee542a79dc57925205395e42a5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sat, 28 Dec 2024 20:59:29 +0100 Subject: [PATCH] fix 500 in locate --- src/c3nav/routing/locator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/c3nav/routing/locator.py b/src/c3nav/routing/locator.py index 697f1d8a..9a0a51f0 100644 --- a/src/c3nav/routing/locator.py +++ b/src/c3nav/routing/locator.py @@ -244,10 +244,12 @@ 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) + router = Router.load() + if len(scan_data_in_the_same_room) == 1: - point = space.point + point = router.spaces[space.pk].point return CustomLocation( - level=space.level_id, + level=router.spaces[space.pk].level_id, x=point.x, y=point.y, permissions=permissions, @@ -262,7 +264,7 @@ class Locator: x = self.peers[peer_id].xyz[0] * value.rssi / the_sum y = self.peers[peer_id].xyz[1] * value.rssi / the_sum return CustomLocation( - level=space.level_id, + level=router.spaces[space.pk].level_id, x=x, y=y, permissions=permissions,