mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-16 22:09:25 +08:00
Hotfix for study groups distance
This commit is contained in:
parent
d1244296f8
commit
dda6b62f37
1 changed files with 5 additions and 0 deletions
|
@ -70,6 +70,11 @@ class StudyGroupDistanceSerializer(serializers.ModelSerializer):
|
|||
fields = '__all__'
|
||||
read_only_fields = ['landmark', 'radius', 'students', 'distance']
|
||||
|
||||
def get_distance(self, obj):
|
||||
if hasattr(obj, 'distance'):
|
||||
return obj.distance.km
|
||||
return 0
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
representation['distance'] = 30
|
||||
|
|
Loading…
Reference in a new issue