Skip to content
Snippets Groups Projects
Unverified Commit bb141956 authored by Emma Green's avatar Emma Green Committed by GitHub
Browse files

Merge pull request #22067 from edx/move-anon-user-check-earlier

move the anonymous check earlier so that it cannot error out when it …
parents 2da9a00d def6bced
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,10 @@ def can_receive_discount(user, course, discount_expiration_date=None):
# TODO: Add additional conditions to return False here
# anonymous users should never get the discount
if user.is_anonymous:
return False
# Check if discount has expired
if not discount_expiration_date:
discount_expiration_date = get_discount_expiration_date(user, course)
......@@ -113,9 +117,6 @@ def can_receive_discount(user, course, discount_expiration_date=None):
if DiscountRestrictionConfig.disabled_for_course_stacked_config(course):
return False
if user.is_anonymous:
return False
# Don't allow users who have enrolled in any courses in non-upsellable
# modes
if CourseEnrollment.objects.filter(user=user).exclude(mode__in=CourseMode.UPSELL_TO_VERIFIED_MODES).exists():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment