Skip to content

Commit

Permalink
Merge pull request #644 from open-craft/sync-open-release/quince.mast…
Browse files Browse the repository at this point in the history
…er-20240311-1710116441

Sync opencraft-release/quince.1 with Upstream 20240311-1710116441
  • Loading branch information
Agrendalath committed Mar 15, 2024
2 parents 505fb80 + b679152 commit 5c2fe16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lms/djangoapps/course_home_api/course_metadata/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def get_url(self, tab):
return request.build_absolute_uri(tab.link_func(self.context.get('course'), reverse))


class CourseModeSerrializer(serializers.Serializer):
"""
Serializer for the Course Mode
"""
slug = serializers.CharField()
name = serializers.CharField()


class CourseHomeMetadataSerializer(VerifiedModeSerializer):
"""
Serializer for the Course Home Course Metadata
Expand All @@ -48,3 +56,4 @@ class CourseHomeMetadataSerializer(VerifiedModeSerializer):
username = serializers.CharField()
user_timezone = serializers.CharField()
can_view_certificate = serializers.BooleanField()
course_modes = CourseModeSerrializer(many=True)
4 changes: 4 additions & 0 deletions lms/djangoapps/course_home_api/course_metadata/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser
from openedx.core.djangoapps.courseware_api.utils import get_celebrations_dict

from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnrollment
from lms.djangoapps.course_api.api import course_detail
from lms.djangoapps.course_goals.models import UserActivity
Expand Down Expand Up @@ -117,6 +118,8 @@ def get(self, request, *args, **kwargs):
# Record course goals user activity for (web) learning mfe course tabs
UserActivity.record_user_activity(request.user, course_key)

course_modes = CourseMode.modes_for_course(course_key, include_expired=True, only_selectable=False)

data = {
'course_id': course.id,
'username': username,
Expand All @@ -133,6 +136,7 @@ def get(self, request, *args, **kwargs):
'celebrations': celebrations,
'user_timezone': user_timezone,
'can_view_certificate': certificates_viewable_for_course(course),
'course_modes': course_modes,
}
context = self.get_serializer_context()
context['course'] = course
Expand Down

0 comments on commit 5c2fe16

Please sign in to comment.