mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-16 22:09:25 +08:00
Increase filter threshhold for student statuses to 100m
This commit is contained in:
parent
46fe8d9397
commit
bf683b08f2
1 changed files with 4 additions and 4 deletions
|
@ -51,9 +51,9 @@ class StudentStatusListByStudentStatusLocation(generics.ListAPIView):
|
|||
# Exclude user
|
||||
# Filter those only with the same subjects as the user
|
||||
# Annotate the queryset with distance to the user
|
||||
# Then filter so that only those within 50m remain
|
||||
# Then filter so that only those within 100m remain
|
||||
return StudentStatus.objects.exclude(user=user).filter(active=True).filter(
|
||||
subject__name__in=user_subject_names).annotate(distance=Distance('location', user_location)).filter(distance__lte=50)
|
||||
subject__name__in=user_subject_names).annotate(distance=Distance('location', user_location)).filter(distance__lte=100)
|
||||
|
||||
|
||||
class StudentStatusListByCurrentLocation(viewsets.ViewSet):
|
||||
|
@ -78,8 +78,8 @@ class StudentStatusListByCurrentLocation(viewsets.ViewSet):
|
|||
# Exclude user
|
||||
# Filter those only with the same subjects as the user
|
||||
# Annotate the queryset with distance to the user
|
||||
# Then filter so that only those within 50m remain
|
||||
# Then filter so that only those within 100m remain
|
||||
queryset = StudentStatus.objects.exclude(user=user).filter(active=True).filter(subject__name__in=user_subject_names).annotate(
|
||||
distance=Distance('location', user_location)).filter(distance__lte=50)
|
||||
distance=Distance('location', user_location)).filter(distance__lte=100)
|
||||
serializer = StudentStatusLocationSerializer(queryset, many=True)
|
||||
return Response(serializer.data)
|
||||
|
|
Loading…
Reference in a new issue