|
|
|
@ -113,6 +113,10 @@ class MyCourseListAPIView(ListAPIView): |
|
|
|
description="мои курсы completed <bool> true", |
|
|
|
type=openapi.TYPE_BOOLEAN, |
|
|
|
), |
|
|
|
openapi.Parameter( |
|
|
|
'certificate', openapi.IN_QUERY, |
|
|
|
type=openapi.TYPE_BOOLEAN, |
|
|
|
), |
|
|
|
], |
|
|
|
operation_description=doc_courses_my_courses(), |
|
|
|
operation_summary="Home", |
|
|
|
@ -137,6 +141,11 @@ class MyCourseListAPIView(ListAPIView): |
|
|
|
distinct=True |
|
|
|
) |
|
|
|
).filter(total_lessons=F('completed_lessons')) |
|
|
|
if certificate := filters.get('certificate', '').lower() == 'true': |
|
|
|
queryset = queryset.exclude( |
|
|
|
course_certificates__student=student, |
|
|
|
course_certificates__status__in=['pending', 'approved'] |
|
|
|
) |
|
|
|
return queryset |
|
|
|
|
|
|
|
|
|
|
|
|