Remove FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG

This commit is contained in:
Matthew Piatetsky
2019-03-07 14:48:36 -05:00
parent 49ae6b9d73
commit 74bcc29417
9 changed files with 8 additions and 47 deletions

View File

@@ -17,9 +17,6 @@ from six import text_type
from django_comment_common.models import assign_default_role
from django_comment_common.utils import seed_permissions_roles
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
from openedx.features.course_duration_limits.config import (
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG
)
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
from openedx.features.content_type_gating.partitions import CONTENT_TYPE_GATING_SCHEME
from student import auth
@@ -464,12 +461,9 @@ def get_visibility_partition_info(xblock, course=None):
if len(partition["groups"]) > 1 or any(group["selected"] for group in partition["groups"]):
selectable_partitions.append(partition)
kill_flag_disabled = not FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled()
course_key = xblock.scope_ids.usage_id.course_key
is_library = isinstance(course_key, LibraryLocator)
if not is_library and (
kill_flag_disabled and ContentTypeGatingConfig.current(course_key=course_key).studio_override_enabled
):
if not is_library and ContentTypeGatingConfig.current(course_key=course_key).studio_override_enabled:
selectable_partitions += get_user_partition_info(xblock, schemes=[CONTENT_TYPE_GATING_SCHEME], course=course)
# Now add the cohort user partitions.

View File

@@ -387,7 +387,7 @@ class CourseListSearchViewTest(CourseApiTestViewMixin, ModuleStoreTestCase, Sear
self.setup_user(self.audit_user)
# These query counts were found empirically
query_counts = [64, 51, 51, 51, 51, 51, 51, 51, 51, 51, 21]
query_counts = [63, 50, 50, 50, 50, 50, 50, 50, 50, 50, 20]
ordered_course_ids = sorted([str(cid) for cid in (course_ids + [c.id for c in self.courses])])
self.clear_caches()

View File

@@ -313,7 +313,7 @@ class TestGradeIteration(SharedModuleStoreTestCase):
else mock_course_grade.return_value
for student in self.students
]
with self.assertNumQueries(8):
with self.assertNumQueries(7):
all_course_grades, all_errors = self._course_grades_and_errors_for(self.course, self.students)
self.assertEqual(
{student: text_type(all_errors[student]) for student in all_errors},

View File

@@ -413,7 +413,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
RequestCache.clear_all_namespaces()
expected_query_count = 49
expected_query_count = 48
with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'):
with check_mongo_calls(mongo_count):
with self.assertNumQueries(expected_query_count):

View File

@@ -21,9 +21,6 @@ from lms.djangoapps.courseware.masquerade import (
from openedx.core.djangoapps.config_model_utils.models import StackedConfigurationModel
from openedx.core.djangoapps.config_model_utils.utils import is_in_holdback
from openedx.features.content_type_gating.helpers import FULL_ACCESS, LIMITED_ACCESS
from openedx.features.course_duration_limits.config import (
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG,
)
from student.models import CourseEnrollment
from student.role_helpers import has_staff_roles
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
@@ -105,9 +102,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
user: The user being queried.
course_key: The CourseKey of the course being queried.
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return False
if enrollment is not None and (user is not None or course_key is not None):
raise ValueError('Specify enrollment or user/course_key, but not both')
@@ -168,9 +162,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
target_datetime: The datetime to checked enablement as of. Defaults to the current date and time.
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return False
if target_datetime is None:
target_datetime = timezone.now()
@@ -189,9 +180,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
target_datetime (:class:`datetime.datetime`): The datetime that ``enabled_as_of`` must be equal to or before
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return False
# Explicitly cast this to bool, so that when self.enabled is None the method doesn't return None
return bool(self.enabled and self.enabled_as_of <= target_datetime)

View File

@@ -73,9 +73,9 @@ class TestContentTypeGatingConfig(CacheIsolationTestCase):
user = self.user
course_key = self.course_overview.id
query_count = 7
query_count = 6
if not already_enrolled or not pass_enrollment and already_enrolled:
query_count = 8
query_count = 7
with self.assertNumQueries(query_count):
enabled = ContentTypeGatingConfig.enabled_for_enrollment(

View File

@@ -7,18 +7,9 @@ from django.dispatch import receiver
from django.db import IntegrityError
from experiments.models import ExperimentData, ExperimentKeyValue
from openedx.core.djangoapps.waffle_utils import WaffleFlagNamespace, WaffleFlag
from student.models import EnrollStatusChange
from student.signals import ENROLL_STATUS_CHANGE
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=u'content_type_gating')
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG = WaffleFlag(
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
flag_name=u'global_kill_switch',
flag_undefined_default=False
)
EXPERIMENT_ID = 11
EXPERIMENT_DATA_HOLDBACK_KEY = 'holdback'

View File

@@ -21,9 +21,6 @@ from lms.djangoapps.courseware.masquerade import (
from openedx.core.djangoapps.config_model_utils.models import StackedConfigurationModel
from openedx.core.djangoapps.config_model_utils.utils import is_in_holdback
from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITION_ID, CONTENT_TYPE_GATE_GROUP_IDS
from openedx.features.course_duration_limits.config import (
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG,
)
from student.models import CourseEnrollment
from student.role_helpers import has_staff_roles
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
@@ -96,9 +93,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
course_key: The CourseKey of the course being queried.
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return False
if enrollment is not None and (user is not None or course_key is not None):
raise ValueError('Specify enrollment or user/course_key, but not both')
@@ -163,9 +157,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
target_datetime: The datetime to checked enablement as of. Defaults to the current date and time.
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return False
if target_datetime is None:
target_datetime = timezone.now()
@@ -184,9 +175,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
target_datetime (:class:`datetime.datetime`): The datetime that ``enabled_as_of`` must be equal to or before
"""
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
return True
# Explicitly cast this to bool, so that when self.enabled is None the method doesn't return None
return bool(self.enabled and self.enabled_as_of <= target_datetime)

View File

@@ -80,9 +80,9 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase):
user = self.user
course_key = self.course_overview.id
query_count = 8
query_count = 7
if pass_enrollment and already_enrolled:
query_count = 7
query_count = 6
with self.assertNumQueries(query_count):
enabled = CourseDurationLimitConfig.enabled_for_enrollment(