Dynamic Pacing: Waffle switch

This commit is contained in:
Nimisha Asthagiri
2017-10-23 18:26:49 -04:00
parent 2211ae335b
commit cd1eaf3010
5 changed files with 47 additions and 8 deletions

View File

@@ -47,6 +47,7 @@ from contentstore.views.helpers import (
from contentstore.views.preview import get_preview_fragment
from edxmako.shortcuts import render_to_string
from models.settings.course_grading import CourseGradingModel
from openedx.core.djangoapps.waffle_utils import WaffleSwitch
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.xblock_utils import request_token, wrap_xblock
from static_replace import replace_static_urls
@@ -1185,7 +1186,7 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
elif xblock.category == 'chapter':
xblock_info.update({
'highlights': xblock.highlights,
'highlights_enabled': settings.FEATURES.get('ENABLE_SECTION_HIGHLIGHTS', False),
'highlights_enabled': highlights_setting().is_enabled(),
})
# update xblock_info with special exam information if the feature flag is enabled
@@ -1247,6 +1248,12 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
return xblock_info
def highlights_setting():
namespace = u'dynamic_pacing'
switch = u'studio_course_update'
return WaffleSwitch(namespace, switch)
def add_container_page_publishing_info(xblock, xblock_info): # pylint: disable=invalid-name
"""
Adds information about the xblock's publish state to the supplied

View File

@@ -33,7 +33,8 @@ from contentstore.views.item import (
_get_source_index,
_xblock_type_and_display_name,
add_container_page_publishing_info,
create_xblock_info
create_xblock_info,
highlights_setting,
)
from lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
@@ -2571,6 +2572,12 @@ class TestXBlockInfo(ItemTest):
self.assertEqual(xblock_info['start'], DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'))
def test_highlights_enabled(self):
chapter = modulestore().get_item(self.chapter.location)
with highlights_setting().override():
xblock_info = create_xblock_info(chapter)
self.assertTrue(xblock_info['highlights_enabled'])
def validate_course_xblock_info(self, xblock_info, has_child_info=True, course_outline=False):
"""
Validate that the xblock info is correct for the test course.
@@ -2598,6 +2605,7 @@ class TestXBlockInfo(ItemTest):
self.assertEqual(xblock_info['due'], None)
self.assertEqual(xblock_info['format'], None)
self.assertEqual(xblock_info['highlights'], self.chapter.highlights)
self.assertFalse(xblock_info['highlights_enabled'])
# Finally, validate the entire response for consistency
self.validate_xblock_info_consistency(xblock_info, has_child_info=has_child_info)

View File

@@ -265,9 +265,6 @@ FEATURES = {
# Whether archived courses (courses with end dates in the past) should be
# shown in Studio in a separate list.
'ENABLE_SEPARATE_ARCHIVED_COURSES': True,
# Whether section-level highlights are enabled on the platform.
'ENABLE_SECTION_HIGHLIGHTS': False,
}
ENABLE_JASMINE = False

View File

@@ -326,8 +326,6 @@ SEARCH_ENGINE = "search.tests.mock_search_engine.MockSearchEngine"
FEATURES['ENABLE_ENROLLMENT_TRACK_USER_PARTITION'] = True
FEATURES['ENABLE_SECTION_HIGHLIGHTS'] = True
########################## AUTHOR PERMISSION #######################
FEATURES['ENABLE_CREATOR_GROUP'] = False