From c3a24c126ec82444a64a418e4cf086f69f296cff Mon Sep 17 00:00:00 2001 From: Andy Shultz Date: Fri, 20 Oct 2023 10:03:53 -0400 Subject: [PATCH] fix: rename update cache functions to what they are --- .../djangoapps/student/models/course_enrollment.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index f44bd934ee57..f4cd5dcc99ba 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -449,7 +449,7 @@ def update_enrollment(self, mode=None, is_active=None, skip_refund=False, enterp if activation_changed or mode_changed: self.save() - self._update_enrollment_in_request_cache( + self._update_enrollment_state_in_request_cache( self.user, self.course_id, CourseEnrollmentState(self.mode, self.is_active), @@ -1337,7 +1337,7 @@ def _get_enrollment_state(cls, user, course_key): enrollment_state = CourseEnrollmentState(record.mode, record.is_active) except cls.DoesNotExist: enrollment_state = CourseEnrollmentState(None, None) - cls._update_enrollment_in_request_cache(user, course_key, enrollment_state) + cls._update_enrollment_state_in_request_cache(user, course_key, enrollment_state) return enrollment_state @classmethod @@ -1354,7 +1354,7 @@ def bulk_fetch_enrollment_states(cls, users, course_key): cache = cls._get_mode_active_request_cache() # lint-amnesty, pylint: disable=redefined-outer-name for record in records: enrollment_state = CourseEnrollmentState(record.mode, record.is_active) - cls._update_enrollment(cache, record.user.id, course_key, enrollment_state) + cls._update_enrollment_state_in_cache(cache, record.user.id, course_key, enrollment_state) @classmethod def _get_mode_active_request_cache(cls): @@ -1372,15 +1372,16 @@ def _get_enrollment_in_request_cache(cls, user, course_key): return cls._get_mode_active_request_cache().get((user.id, course_key)) @classmethod - def _update_enrollment_in_request_cache(cls, user, course_key, enrollment_state): + def _update_enrollment_state_in_request_cache(cls, user, course_key, enrollment_state): """ Updates the cached value for the user's enrollment in the request cache. """ - cls._update_enrollment(cls._get_mode_active_request_cache(), user.id, course_key, enrollment_state) + cls._update_enrollment_state_in_cache(cls._get_mode_active_request_cache(), + user.id, course_key, enrollment_state) @classmethod - def _update_enrollment(cls, cache, user_id, course_key, enrollment_state): # lint-amnesty, pylint: disable=redefined-outer-name + def _update_enrollment_state_in_cache(cls, cache, user_id, course_key, enrollment_state): # lint-amnesty, pylint: disable=redefined-outer-name """ Updates the cached value for the user's enrollment in the given cache.