Skip to content

Commit

Permalink
Add filtering based on course list
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkcuys committed Oct 10, 2023
1 parent 0292605 commit bd07119
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions studygroups/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def get(self, request):
"user": schema.boolean(),
"include_unlisted": schema.boolean(),
"facilitator_guide": schema.boolean(),
"course_list": schema.integer(),
}
data = schema.django_get_to_dict(request.GET)
clean_data, errors = schema.validate(query_schema, data)
Expand Down Expand Up @@ -601,6 +602,11 @@ def get(self, request):
course_ids = StudyGroup.objects.published().exclude(id__in=study_group_ids).values('course')
courses = courses.filter(id__in=course_ids)

if clean_data.get('course_list'):
courses = courses.filter(courselist__pk=clean_data.get('course_list'))
# TODO should this parameter only be available for teams?
# TODO should this take the course list id, or be associated with the current users team membership?

data = {
'count': courses.count()
}
Expand Down

0 comments on commit bd07119

Please sign in to comment.