From 2092933f7263f91793fc904e2af22cd4a03b4f8d Mon Sep 17 00:00:00 2001 From: Chris Deery <3932645+cdeery@users.noreply.github.com> Date: Fri, 3 Sep 2021 11:31:40 -0400 Subject: [PATCH] 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 --- openedx/core/djangoapps/courseware_api/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/courseware_api/utils.py b/openedx/core/djangoapps/courseware_api/utils.py index 4823315692..6e03ecf192 100644 --- a/openedx/core/djangoapps/courseware_api/utils.py +++ b/openedx/core/djangoapps/courseware_api/utils.py @@ -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',