mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-16 22:09:25 +08:00
Fixed incorrect users field in study group viewset
This commit is contained in:
parent
a006aa25f4
commit
032ed36af6
2 changed files with 5 additions and 25 deletions
|
@ -763,7 +763,7 @@ paths:
|
|||
items:
|
||||
$ref: '#/components/schemas/StudyGroup'
|
||||
description: ''
|
||||
/api/v1/study_groups/create//:
|
||||
/api/v1/study_groups/create/:
|
||||
post:
|
||||
operationId: api_v1_study_groups_create_create
|
||||
tags:
|
||||
|
@ -789,7 +789,7 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/StudyGroupCreate'
|
||||
description: ''
|
||||
/api/v1/study_groups/create//{id}/:
|
||||
/api/v1/study_groups/create/{id}/:
|
||||
patch:
|
||||
operationId: api_v1_study_groups_create_partial_update
|
||||
parameters:
|
||||
|
@ -1174,13 +1174,6 @@ components:
|
|||
readOnly: true
|
||||
name:
|
||||
type: string
|
||||
students:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
|
||||
only.
|
||||
nullable: true
|
||||
subject:
|
||||
type: string
|
||||
location:
|
||||
|
@ -1188,8 +1181,6 @@ components:
|
|||
landmark:
|
||||
type: string
|
||||
nullable: true
|
||||
active:
|
||||
type: boolean
|
||||
timestamp:
|
||||
type: string
|
||||
format: date
|
||||
|
@ -1322,8 +1313,6 @@ components:
|
|||
radius:
|
||||
type: number
|
||||
format: double
|
||||
active:
|
||||
type: boolean
|
||||
timestamp:
|
||||
type: string
|
||||
format: date
|
||||
|
@ -1344,13 +1333,6 @@ components:
|
|||
readOnly: true
|
||||
name:
|
||||
type: string
|
||||
students:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
|
||||
only.
|
||||
nullable: true
|
||||
subject:
|
||||
type: string
|
||||
location:
|
||||
|
@ -1358,8 +1340,6 @@ components:
|
|||
landmark:
|
||||
type: string
|
||||
nullable: true
|
||||
active:
|
||||
type: boolean
|
||||
timestamp:
|
||||
type: string
|
||||
format: date
|
||||
|
@ -1368,7 +1348,6 @@ components:
|
|||
- id
|
||||
- location
|
||||
- name
|
||||
- students
|
||||
- subject
|
||||
- timestamp
|
||||
SubjectInstance:
|
||||
|
|
|
@ -50,10 +50,11 @@ class StudyGroupListView(generics.ListAPIView):
|
|||
|
||||
for group in studygroups:
|
||||
# Get all StudentStatus locations of the group
|
||||
group_locations = group.users.values_list('location', flat=True)
|
||||
group_locations = group.students.values_list('location', flat=True)
|
||||
# Convert string locations to GEOSGeometry objects
|
||||
point_locations = [fromstr(loc, srid=4326)
|
||||
for loc in group_locations]
|
||||
|
||||
# Calculate distances between every pair of locations
|
||||
distances = [(loc1.distance(
|
||||
loc2)*100000)for loc1 in point_locations for loc2 in point_locations]
|
||||
|
@ -99,7 +100,7 @@ class StudyGroupListNearView(generics.ListAPIView):
|
|||
|
||||
for group in studygroups:
|
||||
# Get all StudentStatus locations of the group
|
||||
group_locations = group.users.values_list('location', flat=True)
|
||||
group_locations = group.students.values_list('location', flat=True)
|
||||
# Convert string locations to GEOSGeometry objects
|
||||
point_locations = [fromstr(loc, srid=4326)
|
||||
for loc in group_locations]
|
||||
|
|
Loading…
Reference in a new issue