From b66cfa98ce4a1ee18e67f1b4b03f305d2b0a355e Mon Sep 17 00:00:00 2001 From: "Michael J. Roberts" Date: Wed, 24 May 2023 16:09:11 +0100 Subject: [PATCH] feat: Added { latitude } filtering to CRUDBody for self.model.dec. feat: Added { latitude } filtering to CRUDBody for self.model.dec. --- app/crud/crud_body.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/crud/crud_body.py b/app/crud/crud_body.py index a2b8f2a..9c98809 100644 --- a/app/crud/crud_body.py +++ b/app/crud/crud_body.py @@ -116,6 +116,16 @@ def perform_horizontal_altitude_search_filter( # Latitude & Longitude (in degrees): latitude = getattr(query_params, "latitude", None) + if latitude and latitude > 0: + query = query.filter( + self.model.dec > latitude - 90, + ) + + if latitude and latitude < 0: + query = query.filter( + self.model.dec > latitude - 90, + ) + longitude = getattr(query_params, "longitude", None) # Performs a search for the give body above a local altitude of 15 degrees