mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Fix to study group distance and radius
This commit is contained in:
parent
8c13732933
commit
20debf7d45
2 changed files with 2 additions and 5 deletions
|
@ -62,7 +62,6 @@ class StudyGroupDistanceSerializer(serializers.ModelSerializer):
|
|||
location = PointField()
|
||||
landmark = serializers.SlugRelatedField(
|
||||
queryset=Landmark.objects.all(), many=False, slug_field='name', required=False, allow_null=True)
|
||||
radius = serializers.FloatField()
|
||||
distance = serializers.SerializerMethodField(default=0)
|
||||
|
||||
class Meta:
|
||||
|
@ -77,7 +76,8 @@ class StudyGroupDistanceSerializer(serializers.ModelSerializer):
|
|||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
representation['distance'] = 10
|
||||
representation['distance'] = self.get_distance(instance)
|
||||
representation['radius'] = 15
|
||||
return representation
|
||||
|
||||
|
||||
|
|
|
@ -120,9 +120,6 @@ class StudyGroupListNearView(generics.ListAPIView):
|
|||
studygroups = StudyGroup.objects.filter(subject__in=user_subjects).annotate(
|
||||
distance=Distance('location', user_location)).filter(distance__lte=100)
|
||||
|
||||
for group in studygroups:
|
||||
# Annotate the group with the radius
|
||||
group.radius = 30
|
||||
return studygroups
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue