Add course-unawareness option to ExperimentWaffleFlag

For the Courseware MFE rollout experiment, we want users'
default buckets to be consistent across course runs.

ExperimentWaffleFlag advised that this could be done
by calling `.is_enabled(...)` without a course_key argument;
however, doing so breaks when uing the main_flag.BUCKET_NUM
scheme to apply bucket rules for a specific set of users
or courses.

This commit explicitly adds course-unaware-bucketing via
a new kwarg to ExperimentWaffleFlag.__init__ method.

Furthermore, it fixes ExperimentWaffleFlag.is_enabled(course_key=None)
to work as advertised, by means of calling
.is_enabled_without_course_context on its subordinate flags.

TNL-7405
This commit is contained in:
Kyle McCormick
2020-08-06 16:23:00 -04:00
committed by Kyle McCormick
parent 07f96f2bba
commit b05948153a
4 changed files with 156 additions and 20 deletions

View File

@@ -477,7 +477,7 @@ class CourseWaffleFlag(WaffleFlag):
"""
return self._is_enabled()
def is_enabled(self, course_key=None):
def is_enabled(self, course_key):
"""
Returns whether or not the flag is enabled within the context of a given course.