Use SettingDictToggle to document ENABLE_ORA_TEAM_SUBMISSIONS

This commit is contained in:
Régis Behmo
2020-10-16 14:14:40 +02:00
parent 87b5463d42
commit daef264ebb
6 changed files with 46 additions and 52 deletions

View File

@@ -352,18 +352,6 @@ FEATURES = {
'ENABLE_CHANGE_USER_PASSWORD_ADMIN': False,
### ORA Feature Flags ###
# .. toggle_name: ENABLE_ORA_TEAM_SUBMISSIONS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Set to True to enable team-based ORA submissions.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2020-03-03
# .. toggle_target_removal_date: None
# .. toggle_tickets: https://openedx.atlassian.net/browse/EDUCATOR-4951
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
'ENABLE_ORA_TEAM_SUBMISSIONS': False,
# .. toggle_name: ENABLE_ORA_ALL_FILE_URLS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False

View File

@@ -0,0 +1,43 @@
"""
Togglable settings for Teams behavior
"""
from edx_toggles.toggles import SettingDictToggle
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
# Course Waffle inherited from edx/edx-ora2
WAFFLE_NAMESPACE = "openresponseassessment"
TEAM_SUBMISSIONS_FLAG = "team_submissions"
# .. toggle_name: FEATURES['ENABLE_ORA_TEAM_SUBMISSIONS']
# .. toggle_implementation: SettingDictToggle
# .. toggle_default: False
# .. toggle_description: Set to True to enable team-based ORA submissions.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2020-03-03
# .. toggle_target_removal_date: None
# .. toggle_tickets: https://openedx.atlassian.net/browse/EDUCATOR-4951
# .. toggle_warnings: This temporary feature toggle does not have a target removal date. This can be overridden by a
# course waffle flags or a waffle switch with identical name.
# TODO: this should be moved to edx/edx-ora2
TEAM_SUBMISSIONS_FEATURE = SettingDictToggle(
"FEATURES", "ENABLE_ORA_TEAM_SUBMISSIONS", default=False, module_name=__name__
)
def are_team_submissions_enabled(course_key):
"""
Checks to see if the CourseWaffleFlag or Django setting for team submissions is enabled
"""
if CourseWaffleFlag(WAFFLE_NAMESPACE, TEAM_SUBMISSIONS_FLAG, __name__).is_enabled(
course_key
):
return True
# TODO: this behaviour differs from edx-ora2, where the WaffleSwitch overrides the setting.
# https://github.com/edx/edx-ora2/blob/ac502d8301cb987c9885aaefbaeddaf456c13fb9/openassessment/xblock/config_mixin.py#L96
if TEAM_SUBMISSIONS_FEATURE.is_enabled():
return True
return False

View File

@@ -69,7 +69,7 @@ from .serializers import (
TopicSerializer
)
from .utils import emit_team_event
from .waffle import are_team_submissions_enabled
from .toggles import are_team_submissions_enabled
TEAM_MEMBERSHIPS_PER_PAGE = 5
TOPICS_PER_PAGE = 12

View File

@@ -1,26 +0,0 @@
"""
Togglable settings for Teams behavior
"""
from django.conf import settings
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
# Course Waffle inherited from edx/edx-ora2
WAFFLE_NAMESPACE = 'openresponseassessment'
TEAM_SUBMISSIONS_FLAG = 'team_submissions'
# edx/edx-platform feature
TEAM_SUBMISSIONS_FEATURE = 'ENABLE_ORA_TEAM_SUBMISSIONS'
def are_team_submissions_enabled(course_key):
"""
Checks to see if the CourseWaffleFlag or Django setting for team submissions is enabled
"""
if CourseWaffleFlag(WAFFLE_NAMESPACE, TEAM_SUBMISSIONS_FLAG, __name__).is_enabled(course_key):
return True
if settings.FEATURES.get(TEAM_SUBMISSIONS_FEATURE, False):
return True
return False

View File

@@ -606,18 +606,6 @@ FEATURES = {
'ENABLE_LOGISTRATION_MICROFRONTEND': False,
### ORA Feature Flags ###
# .. toggle_name: ENABLE_ORA_TEAM_SUBMISSIONS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Set to True to enable team-based ORA submissions.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2020-03-03
# .. toggle_target_removal_date: None
# .. toggle_tickets: https://openedx.atlassian.net/browse/EDUCATOR-4951
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
'ENABLE_ORA_TEAM_SUBMISSIONS': False,
# .. toggle_name: ENABLE_ORA_ALL_FILE_URLS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False

View File

@@ -2,4 +2,5 @@ from sys_path_hacks.warn import warn_deprecated_import
warn_deprecated_import('lms.djangoapps', 'teams.waffle')
from lms.djangoapps.teams.waffle import *
# pylint: disable=wildcard-import
from lms.djangoapps.teams.toggles import *