Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hook to modify courserun data for executive education courses #33056

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lms/djangoapps/learner_home/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.utils import timezone
from opaque_keys.edx.keys import CourseKey
from rest_framework import serializers
from openedx_filters.learning.filters import CourseEnrollmentAPIRenderStarted
from openedx_filters.learning.filters import CourseEnrollmentAPIRenderStarted, CourseRunAPIRenderStarted

from common.djangoapps.course_modes.models import CourseMode
from openedx.features.course_experience import course_home_url
Expand Down Expand Up @@ -136,6 +136,14 @@ def get_upgradeUrl(self, instance):
def get_resumeUrl(self, instance):
return self.context.get("resume_course_urls", {}).get(instance.course_id)

def to_representation(self, instance):
"""Serialize the courserun instance to be able to update the values before the API finishes rendering."""
serialized_courserun = super().to_representation(instance)
serialized_courserun = CourseRunAPIRenderStarted().run_filter(
serialized_courserun=serialized_courserun,
)
return serialized_courserun


class CoursewareAccessSerializer(serializers.Serializer):
"""
Expand Down
Loading