Merge pull request #63 from WDI-Ideas/development

fix(module_2_filter):improve location filter and ordering nearest event
This commit is contained in:
BOBBY VISHWAKARMA
2024-07-10 12:56:48 +05:30
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -1022,14 +1022,14 @@ class EventListView(generics.ListAPIView):
# Sort by nearest location if latitude and longitude are provided
latitude = self.request.query_params.get("latitude")
longitude = self.request.query_params.get("longitude")
ordering = self.request.query_params.get("ordering", "")
if latitude and longitude:
if latitude and longitude and "nearest" in ordering:
print("latitude fucntion called")
gmaps_service = GoogleMapsservice()
queryset = gmaps_service.get_nearest_events(queryset, float(latitude), float(longitude))
# Apply popularity annotation and ordering if requested
ordering = self.request.query_params.get("ordering")
if ordering:
queryset = self.apply_popularity_latest(queryset, ordering)
return queryset

View File

@@ -22,6 +22,7 @@ django-cors-headers==4.3.1
django-debug-toolbar==4.3.0
django-environ==0.11.2
django-extensions==3.2.3
django-filter==24.2
django-phonenumber-field==7.3.0
django-quill-editor==0.1.40
django-taggit==5.0.1
@@ -69,7 +70,7 @@ sqlparse==0.4.4
stripe==8.2.0
tqdm==4.66.2
Twisted==23.10.0
twisted-iocpsupport==1.0.4
# twisted-iocpsupport==1.0.4
txaio==23.1.1
typing_extensions==4.9.0
tzdata==2024.1