From 829315e0780f18156a6fa49bf8e8f8f740938416 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 22 Jan 2024 13:19:22 -0400 Subject: [PATCH] refactor: move flag to a different shared module --- cms/djangoapps/models/settings/course_metadata.py | 2 +- .../api/processors/team_partition_groups.py | 2 +- openedx/core/djangoapps/course_groups/flags.py | 14 ++++++++++++++ .../course_groups/partition_generator.py | 2 +- .../djangoapps/course_groups/partition_scheme.py | 13 +------------ 5 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 openedx/core/djangoapps/course_groups/flags.py diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py index 77b317712fd3..4809bfcec46e 100644 --- a/cms/djangoapps/models/settings/course_metadata.py +++ b/cms/djangoapps/models/settings/course_metadata.py @@ -16,7 +16,7 @@ from common.djangoapps.xblock_django.models import XBlockStudioConfigurationFlag from openedx.core.djangoapps.course_apps.toggles import exams_ida_enabled from openedx.core.djangoapps.course_groups.partition_generator import MINIMUM_DYNAMIC_TEAM_PARTITION_ID -from openedx.core.djangoapps.course_groups.partition_scheme import CONTENT_GROUPS_FOR_TEAMS +from openedx.core.djangoapps.course_groups.flags import CONTENT_GROUPS_FOR_TEAMS from openedx.core.djangoapps.discussions.config.waffle_utils import legacy_discussion_experience_enabled from openedx.core.lib.teams_config import TeamsetType from openedx.features.course_experience import COURSE_ENABLE_UNENROLLED_ACCESS_FLAG diff --git a/openedx/core/djangoapps/content/learning_sequences/api/processors/team_partition_groups.py b/openedx/core/djangoapps/content/learning_sequences/api/processors/team_partition_groups.py index 02ac247e2039..eb0e2eb6c0c9 100644 --- a/openedx/core/djangoapps/content/learning_sequences/api/processors/team_partition_groups.py +++ b/openedx/core/djangoapps/content/learning_sequences/api/processors/team_partition_groups.py @@ -10,7 +10,7 @@ from openedx.core import types from openedx.core.djangoapps.content.learning_sequences.api.processors.base import OutlineProcessor from openedx.core.djangoapps.course_groups.partition_generator import create_team_set_partition_with_course_id -from openedx.core.djangoapps.course_groups.partition_scheme import CONTENT_GROUPS_FOR_TEAMS +from openedx.core.djangoapps.course_groups.flags import CONTENT_GROUPS_FOR_TEAMS from xmodule.partitions.partitions import Group from xmodule.partitions.partitions_service import get_user_partition_groups diff --git a/openedx/core/djangoapps/course_groups/flags.py b/openedx/core/djangoapps/course_groups/flags.py new file mode 100644 index 000000000000..74be1270c387 --- /dev/null +++ b/openedx/core/djangoapps/course_groups/flags.py @@ -0,0 +1,14 @@ +"""Flags for the course_groups app.""" +from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag + +COURSE_GROUPS_NAMESPACE = "course_groups" + +# .. toggle_name: course_groups.content_groups_for_teams +# .. toggle_implementation: CourseWaffleFlag +# .. toggle_default: False +# .. toggle_description: This flag enables the use of content groups for teams. +# .. toggle_use_cases: open_edx +# .. toggle_creation_date: 2023-11-23 +CONTENT_GROUPS_FOR_TEAMS = CourseWaffleFlag( + f"{COURSE_GROUPS_NAMESPACE}.content_groups_for_teams", __name__ +) diff --git a/openedx/core/djangoapps/course_groups/partition_generator.py b/openedx/core/djangoapps/course_groups/partition_generator.py index 8d02ebf26788..f159ea9edf0f 100644 --- a/openedx/core/djangoapps/course_groups/partition_generator.py +++ b/openedx/core/djangoapps/course_groups/partition_generator.py @@ -6,7 +6,7 @@ from django.conf import settings from django.utils.translation import gettext_lazy as _ -from openedx.core.djangoapps.course_groups.partition_scheme import CONTENT_GROUPS_FOR_TEAMS +from openedx.core.djangoapps.course_groups.flags import CONTENT_GROUPS_FOR_TEAMS from xmodule.partitions.partitions import UserPartition, UserPartitionError from xmodule.services import TeamsConfigurationService diff --git a/openedx/core/djangoapps/course_groups/partition_scheme.py b/openedx/core/djangoapps/course_groups/partition_scheme.py index 9b9b5726c36b..356623b0bdc4 100644 --- a/openedx/core/djangoapps/course_groups/partition_scheme.py +++ b/openedx/core/djangoapps/course_groups/partition_scheme.py @@ -20,22 +20,11 @@ UserPartition ) from xmodule.services import TeamsConfigurationService -from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag +from openedx.core.djangoapps.course_groups.flags import CONTENT_GROUPS_FOR_TEAMS from .cohorts import get_cohort, get_group_info_for_cohort log = logging.getLogger(__name__) -COURSE_GROUPS_NAMESPACE = "course_groups" - -# .. toggle_name: course_groups.content_groups_for_teams -# .. toggle_implementation: CourseWaffleFlag -# .. toggle_default: False -# .. toggle_description: This flag enables the use of content groups for teams. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2023-11-23 -CONTENT_GROUPS_FOR_TEAMS = CourseWaffleFlag( - f"{COURSE_GROUPS_NAMESPACE}.content_groups_for_teams", __name__ -) class CohortPartitionScheme: