From fadc9618d4df8cc1b7c6d94158d1c8c26e523337 Mon Sep 17 00:00:00 2001 From: Andy Shultz Date: Tue, 17 Oct 2023 14:01:06 -0400 Subject: [PATCH 1/3] docs: fix old course_id arg description to modern(2015) usage the code asserts that this is a key rather than a string --- common/djangoapps/student/models/course_enrollment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index f4cd5dcc99ba..f4ef557afdd8 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -330,7 +330,7 @@ def get_or_create_enrollment(cls, user, course_key): attribute), this method will automatically save it before adding an enrollment for it. - `course_id` is our usual course_id string (e.g. "edX/Test101/2013_Fall) + `course_key` must be a opaque_keys CourseKey object. It is expected that this method is called from a method which has already verified the user authentication and access. From 2fde582a4d0ae7c287274c16fbf0dab535a273e3 Mon Sep 17 00:00:00 2001 From: Andy Shultz Date: Tue, 17 Oct 2023 14:02:05 -0400 Subject: [PATCH 2/3] docs: remove TODO which asks a question where the answer is no TODO posits cache key is not in use, it is used in this file via signal. --- common/djangoapps/student/models/course_enrollment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index f4ef557afdd8..dfacf5706447 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -287,7 +287,7 @@ def course_price(self): objects = CourseEnrollmentManager() # cache key format e.g enrollment...mode = 'honor' - COURSE_ENROLLMENT_CACHE_KEY = "enrollment.{}.{}.mode" # TODO Can this be removed? It doesn't seem to be used. + COURSE_ENROLLMENT_CACHE_KEY = "enrollment.{}.{}.mode" MODE_CACHE_NAMESPACE = 'CourseEnrollment.mode_and_active' From ad90c05b98f616cf85faf1d28cd8f83864f7c041 Mon Sep 17 00:00:00 2001 From: Andy Shultz Date: Tue, 17 Oct 2023 15:11:16 -0400 Subject: [PATCH 3/3] fix: remove unused and untested function --- common/djangoapps/student/models/course_enrollment.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index dfacf5706447..d89a8d967a00 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -225,12 +225,6 @@ def enrollment_counts(self, course_id): enroll_dict['total'] = total return enroll_dict - def enrolled_and_dropped_out_users(self, course_id): - """Return a queryset of Users in the course.""" - return User.objects.filter( - courseenrollment__course_id=course_id - ) - # Named tuple for fields pertaining to the state of # CourseEnrollment for a user in a course. This type