Commit dec4034b by Nimisha Asthagiri Committed by GitHub

Merge pull request #14177 from edx/naa/fix-marketing-pr

Fix Enrollment database access in Marketing Course URL PR
parents ef55cc4f f2483091
...@@ -272,13 +272,15 @@ class UserCourseEnrollmentsList(APIView): ...@@ -272,13 +272,15 @@ class UserCourseEnrollmentsList(APIView):
Returns a list of courses enrolled by user. Returns a list of courses enrolled by user.
""" """
queryset = CourseEnrollment.objects.all() queryset = CourseEnrollment.objects.all()
course_ids = set(queryset.values_list('course_id', flat=True)) enrollments = list(
queryset.filter(
user__username=username,
is_active=True
).order_by('created').reverse()
)
course_ids = [enrollment.course_id for enrollment in enrollments]
catalog_course_runs_against_course_keys = get_course_runs(course_ids, request.user) catalog_course_runs_against_course_keys = get_course_runs(course_ids, request.user)
enrollments = queryset.filter(
user__username=username,
is_active=True
).order_by('created').reverse()
org = request.query_params.get('org', None) org = request.query_params.get('org', None)
return Response([ return Response([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment