Skip to content

Commit

Permalink
Merge pull request #33056 from openedx/eahmadjaved/ENT-7542
Browse files Browse the repository at this point in the history
feat: add hook to modify courserun data for executive education courses
  • Loading branch information
jajjibhai008 committed Aug 28, 2023
2 parents a0076c1 + fa70214 commit 07de29f
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 07de29f

Please sign in to comment.