fix 500 in locate
This commit is contained in:
parent
fae4c6f148
commit
7cc0973800
1 changed files with 5 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue