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(
|
distance = distance_between_coords(
|
||||||
lhs=room.coord,
|
lhs=room.coord,
|
||||||
rhs=Coordinates(
|
rhs=Coordinates(
|
||||||
latitude=int(request.args["lat"]),
|
latitude=float(request.args["lat"]),
|
||||||
longitude=int(request.args["lon"]),
|
longitude=float(request.args["lon"]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ def room_new():
|
||||||
|
|
||||||
room = Room(
|
room = Room(
|
||||||
id=max(state.rooms or [0]) + 1,
|
id=max(state.rooms or [0]) + 1,
|
||||||
coord=Coordinates(int(lat), int(lon)),
|
coord=Coordinates(float(lat), float(lon)),
|
||||||
range_size=int(room_range),
|
range_size=int(room_range),
|
||||||
name=room_name,
|
name=room_name,
|
||||||
pin=room_pin,
|
pin=room_pin,
|
||||||
|
@ -175,7 +175,7 @@ def room():
|
||||||
lon = request.args.get("lon")
|
lon = request.args.get("lon")
|
||||||
|
|
||||||
if lat and lon:
|
if lat and lon:
|
||||||
user_coords = Coordinates(latitude=int(lat), longitude=int(lon))
|
user_coords = Coordinates(latitude=float(lat), longitude=float(lon))
|
||||||
else:
|
else:
|
||||||
return error("Missing user coordinates")
|
return error("Missing user coordinates")
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ from dataclasses import dataclass
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Coordinates:
|
class Coordinates:
|
||||||
latitude: int
|
latitude: float
|
||||||
longitude: int
|
longitude: float
|
||||||
|
|
||||||
|
|
||||||
def distance_between_coords(lhs: Coordinates, rhs: Coordinates) -> float:
|
def distance_between_coords(lhs: Coordinates, rhs: Coordinates) -> float:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue