From cea450a35bfd5d1faec55e9ded3668c2692aa96b Mon Sep 17 00:00:00 2001 From: Matthew Piatetsky Date: Tue, 1 Jun 2021 16:29:42 -0400 Subject: [PATCH] fix: pass in course key when checking the bucket for the streak discount experiment --- lms/djangoapps/experiments/flags.py | 2 ++ openedx/core/djangoapps/courseware_api/utils.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/experiments/flags.py b/lms/djangoapps/experiments/flags.py index 6d8641421c..9803877f6d 100644 --- a/lms/djangoapps/experiments/flags.py +++ b/lms/djangoapps/experiments/flags.py @@ -175,6 +175,8 @@ class ExperimentWaffleFlag(CourseWaffleFlag): Arguments: course_key (Optional[CourseKey]) + This argument should always be passed in a course-aware context even if + course aware bucketing is False. track (bool): Whether an analytics event should be generated if the user is bucketed for the first time. diff --git a/openedx/core/djangoapps/courseware_api/utils.py b/openedx/core/djangoapps/courseware_api/utils.py index 4c23c701fd..0ecbcf57e6 100644 --- a/openedx/core/djangoapps/courseware_api/utils.py +++ b/openedx/core/djangoapps/courseware_api/utils.py @@ -37,7 +37,7 @@ def get_celebrations_dict(user, enrollment, course, browser_timezone): # We only want to bucket people into the AA-759 experiment # if the course has not ended, is upgradeable and the user is not an enterprise learner if can_show_streak_discount_experiment_coupon(user, course): - celebrations['streak_discount_experiment_enabled'] = STREAK_DISCOUNT_EXPERIMENT_FLAG.is_enabled() + celebrations['streak_discount_experiment_enabled'] = STREAK_DISCOUNT_EXPERIMENT_FLAG.is_enabled(course.id) return celebrations