fix: [AA-950] Fix gating feature from WaffleFlag (#28652)

* fix: [AA-950] Fix gating feature from WaffleFlag

Streak Discount was being offered for non-verified courses
This commit is contained in:
Chris Deery
2021-09-03 11:31:40 -04:00
committed by GitHub
parent 39b44c8bd7
commit 2092933f72

View File

@@ -36,14 +36,15 @@ def get_celebrations_dict(user, enrollment, course, browser_timezone):
if streak_length_to_celebrate:
# We only want to offer the streak discount
# if the course has not ended, is upgradeable and the user is not an enterprise learner
if can_show_streak_discount_coupon(user, course):
celebrations['streak_discount_enabled'] = COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT.is_enabled()
discount_enabled = COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT.is_enabled()
if can_show_streak_discount_coupon(user, course) and discount_enabled:
# Send course streak coupon event
course_key = str(course.id)
modes_dict = CourseMode.modes_for_course_dict(course_id=course_key, include_expired=False)
verified_mode = modes_dict.get('verified', None)
if verified_mode:
celebrations['streak_discount_enabled'] = discount_enabled
segment.track(
user_id=user.id,
event_name='edx.bi.course.streak_discount_enabled',