Skip to content

Commit

Permalink
Merge pull request #1787 from openedx/ammar/add-extended-data-in-ente…
Browse files Browse the repository at this point in the history
…rprise-course-enrollments-api

feat: add more metadata into `EnterpriseCourseEnrollmentView`
  • Loading branch information
muhammad-ammar authored Jul 4, 2023
2 parents c2eb69a + 43a83fa commit 206b5fc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Change Log
Unreleased
----------
[3.68.0]
--------
feat: add more metadata into `EnterpriseCourseEnrollmentView`

[3.67.7]
--------
feat: marking orphaned content audits when catalogs are deleted
Expand All @@ -33,7 +37,7 @@ feat: add button to update customer modified time

[3.67.3]
--------
feat: adding managent command to clear error state
feat: adding managent command to clear error state

[3.67.2]
--------
Expand Down Expand Up @@ -99,7 +103,7 @@ fix: making sure unenrollment is saved while revoking fulfillment

[3.65.0]
--------
feat: new enterprise endpoint to surface filterable unenrolled subsidized enrollments
feat: new enterprise endpoint to surface filterable unenrolled subsidized enrollments

[3.64.1]
--------
Expand All @@ -108,10 +112,10 @@ fix: Reverted course_run_url for Executive Education courses
[3.64.0]
--------
feat: Updated course_run_url for Executive Education courses

[3.63.0]
--------
feat: Hooking enterprise enrollments up to platform signals to write unenrollment records.
feat: Hooking enterprise enrollments up to platform signals to write unenrollment records.
New field `unenrolled` on enterprise enrollments to track enrollment status, defaults to `None`.

[3.62.7]
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Your project description goes here.
"""

__version__ = "3.67.7"
__version__ = "3.68.0"

default_app_config = "enterprise.apps.EnterpriseConfig"
14 changes: 14 additions & 0 deletions enterprise_learner_portal/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
get_course_run_url = None
get_emails_enabled = None

try:
from federated_content_connector.models import CourseDetails
except ImportError:
CourseDetails = None


class EnterpriseCourseEnrollmentSerializer(serializers.Serializer): # pylint: disable=abstract-method
"""
Expand Down Expand Up @@ -73,6 +78,15 @@ def to_representation(self, instance):
representation['is_enrollment_active'] = instance.is_active
representation['mode'] = instance.mode

if CourseDetails:
course_details = CourseDetails.objects.filter(id=course_run_id)
if course_details:
representation['course_type'] = course_details.course_type
representation['product_source'] = course_details.product_source
representation['start_date'] = course_details.start_date or representation['start_date']
representation['end_date'] = course_details.end_date or representation['end_date']
representation['enroll_by'] = course_details.enroll_by

return representation

def _get_course_overview(self, course_run_id):
Expand Down

0 comments on commit 206b5fc

Please sign in to comment.