fix: [AA-950] Change coupon flag from WaffleFlag to CourseWaffleFlag (#28623)

Replacing the streak_celebration.discount_experiment_AA759 Waffle flag with
courseware.streak_discount_enabled CourseWaffleFlag

https://openedx.atlassian.net/browse/AA-950

Co-authored-by: cdeery <cdeery@edx.edu>
This commit is contained in:
Chris Deery
2021-09-02 08:32:56 -04:00
committed by GitHub
parent 32053c6ab4
commit c4cedbae38
5 changed files with 21 additions and 20 deletions

View File

@@ -29,7 +29,7 @@ from lms.djangoapps.courseware.toggles import (
COURSEWARE_MICROFRONTEND_SPECIAL_EXAMS,
COURSEWARE_MICROFRONTEND_PROCTORED_EXAMS,
)
from lms.djangoapps.experiments.utils import STREAK_DISCOUNT_FLAG
from lms.djangoapps.courseware.toggles import COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT
from lms.djangoapps.verify_student.services import IDVerificationService
from common.djangoapps.student.models import (
CourseEnrollment, CourseEnrollmentCelebration
@@ -301,7 +301,7 @@ class CourseApiTestViews(BaseCoursewareTests, MasqueradeMixin):
def test_streak_data_in_response(self):
""" Test that metadata endpoint returns data for the streak celebration """
CourseEnrollment.enroll(self.user, self.course.id, 'audit')
with override_waffle_flag(STREAK_DISCOUNT_FLAG, active=True):
with override_waffle_flag(COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT, active=True):
with mock.patch('common.djangoapps.student.models.UserCelebration.perform_streak_updates', return_value=3):
response = self.client.get(self.url, content_type='application/json')
celebrations = response.json()['celebrations']

View File

@@ -7,7 +7,7 @@ from babel.numbers import get_currency_symbol
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnrollmentCelebration, UserCelebration
from lms.djangoapps.courseware.utils import can_show_verified_upgrade, verified_upgrade_deadline_link
from lms.djangoapps.experiments.utils import STREAK_DISCOUNT_FLAG
from lms.djangoapps.courseware.toggles import COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT
from openedx.features.course_duration_limits.access import get_user_course_expiration_date
from openedx.features.discounts.applicability import can_show_streak_discount_coupon
from common.djangoapps.track import segment
@@ -37,7 +37,7 @@ def get_celebrations_dict(user, enrollment, course, browser_timezone):
# 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'] = STREAK_DISCOUNT_FLAG.is_enabled()
celebrations['streak_discount_enabled'] = COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT.is_enabled()
# Send course streak coupon event
course_key = str(course.id)