Commit 1fbd581b by Uman Shahzad Committed by Uman Shahzad

Remove `else` block to make enrollment caching path more clear.

parent d040ce6e
...@@ -84,10 +84,9 @@ class ProgramCourseRunSeatsCondition(Condition): ...@@ -84,10 +84,9 @@ class ProgramCourseRunSeatsCondition(Condition):
user = basket.owner.username user = basket.owner.username
try: try:
enrollments = api.enrollment.get(user=user) enrollments = api.enrollment.get(user=user)
cache.set(cache_key, enrollments, settings.ENROLLMENT_API_CACHE_TIMEOUT)
except (ConnectionError, SlumberBaseException, Timeout) as exc: except (ConnectionError, SlumberBaseException, Timeout) as exc:
logger.error('Failed to retrieve enrollments: %s', str(exc)) logger.error('Failed to retrieve enrollments: %s', str(exc))
else:
cache.set(cache_key, enrollments, settings.ENROLLMENT_API_CACHE_TIMEOUT)
for course in program['courses']: for course in program['courses']:
# If the user is already enrolled in a course, we do not need to check their basket for it # If the user is already enrolled in a course, we do not need to check their basket for it
......
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