forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from edly-io/feat/add-progress-and-completion…
…-apis feat: add progress list API and Course completion API
- Loading branch information
Showing
8 changed files
with
291 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import django_filters | ||
from lms.djangoapps.certificates.models import GeneratedCertificate | ||
|
||
|
||
class GeneratedCertificateFilter(django_filters.FilterSet): | ||
created_date = django_filters.DateFilter(field_name='created_date', lookup_expr='date') | ||
date_gt = django_filters.DateFilter(field_name='created_date', lookup_expr='gt') | ||
date_lt = django_filters.DateFilter(field_name='created_date', lookup_expr='lt') | ||
|
||
class Meta: | ||
model = GeneratedCertificate | ||
fields = ['created_date', 'date_gt', 'date_lt'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from rest_framework import serializers | ||
|
||
from lms.djangoapps.certificates.models import GeneratedCertificate | ||
|
||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview | ||
from openedx.core.djangoapps.enrollments.serializers import CourseSerializer | ||
from openedx.core.djangoapps.user_api.serializers import UserSerializer | ||
|
||
class GeneratedCertificateSerializer(serializers.ModelSerializer): | ||
"""Serializers have an abstract create & update, but we often don't need them. So this silences the linter.""" | ||
|
||
course_info = serializers.SerializerMethodField() | ||
user = UserSerializer() | ||
|
||
def get_course_info(self, obj): | ||
try: | ||
self._course_overview = CourseOverview.get_from_id(obj.course_id) | ||
if self._course_overview: | ||
self._course_overview = CourseSerializer(self._course_overview).data | ||
except (CourseOverview.DoesNotExist, OSError): | ||
self._course_overview = None | ||
return self._course_overview | ||
|
||
|
||
class Meta: | ||
model = GeneratedCertificate | ||
fields = ('user', 'course_id', 'created_date', 'grade', 'key', 'status', 'mode', 'name', 'course_info') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters