Fix coord float
This commit is contained in:
parent
cd5e52cb23
commit
244e49d311
2 changed files with 6 additions and 6 deletions
|
@ -88,8 +88,8 @@ def join():
|
|||
distance = distance_between_coords(
|
||||
lhs=room.coord,
|
||||
rhs=Coordinates(
|
||||
latitude=int(request.args["lat"]),
|
||||
longitude=int(request.args["lon"]),
|
||||
latitude=float(request.args["lat"]),
|
||||
longitude=float(request.args["lon"]),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -153,7 +153,7 @@ def room_new():
|
|||
|
||||
room = Room(
|
||||
id=max(state.rooms or [0]) + 1,
|
||||
coord=Coordinates(int(lat), int(lon)),
|
||||
coord=Coordinates(float(lat), float(lon)),
|
||||
range_size=int(room_range),
|
||||
name=room_name,
|
||||
pin=room_pin,
|
||||
|
@ -175,7 +175,7 @@ def room():
|
|||
lon = request.args.get("lon")
|
||||
|
||||
if lat and lon:
|
||||
user_coords = Coordinates(latitude=int(lat), longitude=int(lon))
|
||||
user_coords = Coordinates(latitude=float(lat), longitude=float(lon))
|
||||
else:
|
||||
return error("Missing user coordinates")
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ from dataclasses import dataclass
|
|||
|
||||
@dataclass
|
||||
class Coordinates:
|
||||
latitude: int
|
||||
longitude: int
|
||||
latitude: float
|
||||
longitude: float
|
||||
|
||||
|
||||
def distance_between_coords(lhs: Coordinates, rhs: Coordinates) -> float:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue