add external_user_key to response and add ability to search by username, email, or external user key
Code review comments - EDUCATOR-4319 undoing changes temporarily undoing changes temporarily Fixed exception handling re-added changes after hard reset removed waffle flag (wrong merge removed waffle flag (wrong merge
This commit is contained in:
@@ -1244,6 +1244,26 @@ class CourseEnrollment(models.Model):
|
||||
except cls.DoesNotExist:
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_program_enrollment(cls, user, course_id):
|
||||
"""
|
||||
Return the ProgramEnrollment associated with the CourseEnrollment specified
|
||||
by the user and course_id.
|
||||
Return None if there is no ProgramEnrollment.
|
||||
|
||||
Arguments:
|
||||
user (User): the user for whom we want the program enrollment
|
||||
coure_id (CourseKey): the id of the course the user has a course enrollment in
|
||||
|
||||
Returns:
|
||||
ProgramEnrollment object or None
|
||||
"""
|
||||
try:
|
||||
course_enrollment = cls.objects.get(user=user, course_id=course_id)
|
||||
return course_enrollment.programcourseenrollment.program_enrollment
|
||||
except (ObjectDoesNotExist):
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def is_enrollment_closed(cls, user, course):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user