Skip to content

Commit

Permalink
Refactor distance check in EmergencyGeneralController
Browse files Browse the repository at this point in the history
  • Loading branch information
naman108 committed Dec 29, 2023
1 parent 5255ff4 commit 1517fa9
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ def validate_user_distance(self, emergency: Event, connection):

# check that the distance between the user and the emergency is less than 10km
# TODO: this hardcoded distance should be added to the business rules
return (
distance.geodesic(
(connection_location.lat, connection_location.lon),
(emergency.point.lat, emergency.point.lon),
).km
< config.EmergencyRadius
)
if config.EmergencyRadius==0:
return True
else:
return (
distance.geodesic(
(connection_location.lat, connection_location.lon),
(emergency.point.lat, emergency.point.lon),
).km
< config.EmergencyRadius
)

0 comments on commit 1517fa9

Please sign in to comment.