From 74bcc2941769d48bbbc85292e741abea2757fd49 Mon Sep 17 00:00:00 2001 From: Matthew Piatetsky Date: Thu, 7 Mar 2019 14:48:36 -0500 Subject: [PATCH] Remove FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG --- cms/djangoapps/contentstore/utils.py | 8 +------- lms/djangoapps/course_api/tests/test_views.py | 2 +- .../grades/tests/test_course_grade_factory.py | 2 +- .../instructor_task/tests/test_tasks_helper.py | 2 +- openedx/features/content_type_gating/models.py | 12 ------------ .../content_type_gating/tests/test_models.py | 4 ++-- openedx/features/course_duration_limits/config.py | 9 --------- openedx/features/course_duration_limits/models.py | 12 ------------ .../course_duration_limits/tests/test_models.py | 4 ++-- 9 files changed, 8 insertions(+), 47 deletions(-) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index bc4f14b072..6cea7f65d1 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -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. diff --git a/lms/djangoapps/course_api/tests/test_views.py b/lms/djangoapps/course_api/tests/test_views.py index 4ca9cecf2a..0f84860206 100644 --- a/lms/djangoapps/course_api/tests/test_views.py +++ b/lms/djangoapps/course_api/tests/test_views.py @@ -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() diff --git a/lms/djangoapps/grades/tests/test_course_grade_factory.py b/lms/djangoapps/grades/tests/test_course_grade_factory.py index 6ddbfd1be7..7206db0bcb 100644 --- a/lms/djangoapps/grades/tests/test_course_grade_factory.py +++ b/lms/djangoapps/grades/tests/test_course_grade_factory.py @@ -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}, diff --git a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py index 40c53951c3..05e961dc84 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py @@ -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): diff --git a/openedx/features/content_type_gating/models.py b/openedx/features/content_type_gating/models.py index ddabb2f276..26bb3f4118 100644 --- a/openedx/features/content_type_gating/models.py +++ b/openedx/features/content_type_gating/models.py @@ -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) diff --git a/openedx/features/content_type_gating/tests/test_models.py b/openedx/features/content_type_gating/tests/test_models.py index 06385ced65..ef3421b925 100644 --- a/openedx/features/content_type_gating/tests/test_models.py +++ b/openedx/features/content_type_gating/tests/test_models.py @@ -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( diff --git a/openedx/features/course_duration_limits/config.py b/openedx/features/course_duration_limits/config.py index 9f6cf7ae55..9328d25fb4 100644 --- a/openedx/features/course_duration_limits/config.py +++ b/openedx/features/course_duration_limits/config.py @@ -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' diff --git a/openedx/features/course_duration_limits/models.py b/openedx/features/course_duration_limits/models.py index 9a37105b3c..1dbf659db6 100644 --- a/openedx/features/course_duration_limits/models.py +++ b/openedx/features/course_duration_limits/models.py @@ -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) diff --git a/openedx/features/course_duration_limits/tests/test_models.py b/openedx/features/course_duration_limits/tests/test_models.py index 9bd30a7f29..3e14a2fbed 100644 --- a/openedx/features/course_duration_limits/tests/test_models.py +++ b/openedx/features/course_duration_limits/tests/test_models.py @@ -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(