Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Remove else block to make enrollment caching path more clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
Uman Shahzad authored and UmanShahzad committed Sep 12, 2017
1 parent d040ce6 commit 1fbd581
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ecommerce/programs/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ def is_satisfied(self, offer, basket): # pylint: disable=unused-argument
user = basket.owner.username
try:
enrollments = api.enrollment.get(user=user)
cache.set(cache_key, enrollments, settings.ENROLLMENT_API_CACHE_TIMEOUT)
except (ConnectionError, SlumberBaseException, Timeout) as 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']:
# If the user is already enrolled in a course, we do not need to check their basket for it
Expand Down

0 comments on commit 1fbd581

Please sign in to comment.