Skip to content

Commit

Permalink
Merge pull request openedx#33550 from openedx/ashultz0/rename_second_…
Browse files Browse the repository at this point in the history
…update_enrollment

fix: rename update cache functions to what they are
  • Loading branch information
ashultz0 authored Oct 23, 2023
2 parents e932373 + c3a24c1 commit 7770e51
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions common/djangoapps/student/models/course_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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.
Expand Down

0 comments on commit 7770e51

Please sign in to comment.