mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +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:
|
items:
|
||||||
$ref: '#/components/schemas/StudyGroup'
|
$ref: '#/components/schemas/StudyGroup'
|
||||||
description: ''
|
description: ''
|
||||||
/api/v1/study_groups/create//:
|
/api/v1/study_groups/create/:
|
||||||
post:
|
post:
|
||||||
operationId: api_v1_study_groups_create_create
|
operationId: api_v1_study_groups_create_create
|
||||||
tags:
|
tags:
|
||||||
|
@ -789,7 +789,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/StudyGroupCreate'
|
$ref: '#/components/schemas/StudyGroupCreate'
|
||||||
description: ''
|
description: ''
|
||||||
/api/v1/study_groups/create//{id}/:
|
/api/v1/study_groups/create/{id}/:
|
||||||
patch:
|
patch:
|
||||||
operationId: api_v1_study_groups_create_partial_update
|
operationId: api_v1_study_groups_create_partial_update
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -1174,13 +1174,6 @@ components:
|
||||||
readOnly: true
|
readOnly: true
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
students:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
|
|
||||||
only.
|
|
||||||
nullable: true
|
|
||||||
subject:
|
subject:
|
||||||
type: string
|
type: string
|
||||||
location:
|
location:
|
||||||
|
@ -1188,8 +1181,6 @@ components:
|
||||||
landmark:
|
landmark:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
timestamp:
|
timestamp:
|
||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
|
@ -1322,8 +1313,6 @@ components:
|
||||||
radius:
|
radius:
|
||||||
type: number
|
type: number
|
||||||
format: double
|
format: double
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
timestamp:
|
timestamp:
|
||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
|
@ -1344,13 +1333,6 @@ components:
|
||||||
readOnly: true
|
readOnly: true
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
students:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
|
|
||||||
only.
|
|
||||||
nullable: true
|
|
||||||
subject:
|
subject:
|
||||||
type: string
|
type: string
|
||||||
location:
|
location:
|
||||||
|
@ -1358,8 +1340,6 @@ components:
|
||||||
landmark:
|
landmark:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
timestamp:
|
timestamp:
|
||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
|
@ -1368,7 +1348,6 @@ components:
|
||||||
- id
|
- id
|
||||||
- location
|
- location
|
||||||
- name
|
- name
|
||||||
- students
|
|
||||||
- subject
|
- subject
|
||||||
- timestamp
|
- timestamp
|
||||||
SubjectInstance:
|
SubjectInstance:
|
||||||
|
|
|
@ -50,10 +50,11 @@ class StudyGroupListView(generics.ListAPIView):
|
||||||
|
|
||||||
for group in studygroups:
|
for group in studygroups:
|
||||||
# Get all StudentStatus locations of the group
|
# 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
|
# Convert string locations to GEOSGeometry objects
|
||||||
point_locations = [fromstr(loc, srid=4326)
|
point_locations = [fromstr(loc, srid=4326)
|
||||||
for loc in group_locations]
|
for loc in group_locations]
|
||||||
|
|
||||||
# Calculate distances between every pair of locations
|
# Calculate distances between every pair of locations
|
||||||
distances = [(loc1.distance(
|
distances = [(loc1.distance(
|
||||||
loc2)*100000)for loc1 in point_locations for loc2 in point_locations]
|
loc2)*100000)for loc1 in point_locations for loc2 in point_locations]
|
||||||
|
@ -99,7 +100,7 @@ class StudyGroupListNearView(generics.ListAPIView):
|
||||||
|
|
||||||
for group in studygroups:
|
for group in studygroups:
|
||||||
# Get all StudentStatus locations of the group
|
# 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
|
# Convert string locations to GEOSGeometry objects
|
||||||
point_locations = [fromstr(loc, srid=4326)
|
point_locations = [fromstr(loc, srid=4326)
|
||||||
for loc in group_locations]
|
for loc in group_locations]
|
||||||
|
|
Loading…
Reference in a new issue