diff --git a/lms/djangoapps/course_home_api/outline/serializers.py b/lms/djangoapps/course_home_api/outline/serializers.py index 85c2c3e190bb..9c739fa37904 100644 --- a/lms/djangoapps/course_home_api/outline/serializers.py +++ b/lms/djangoapps/course_home_api/outline/serializers.py @@ -2,6 +2,7 @@ Outline Tab Serializers. """ +from django.conf import settings # lint-amnesty, pylint: disable=wrong-import-order from django.utils.translation import ngettext from rest_framework import serializers @@ -28,7 +29,8 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring num_graded_problems = block.get('num_graded_problems', 0) scored = block.get('scored') - if num_graded_problems and block_type == 'sequential': + if (settings.FEATURES.get('ENABLE_COURSEWARE_OUTLINE_QUESTION_COUNT') and + num_graded_problems and block_type == 'sequential'): questions = ngettext('({number} Question)', '({number} Questions)', num_graded_problems) display_name += ' ' + questions.format(number=num_graded_problems) @@ -39,6 +41,12 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring description = block['special_exam_info'].get('short_description') icon = block['special_exam_info'].get('suggested_icon', 'fa-pencil-square-o') + effort_activities = None + effort_time = None + if settings.FEATURES.get('ENABLE_COURSEWARE_OUTLINE_EFFORT_ESTIMATES'): + effort_activities = block.get('effort_activities') + effort_time = block.get('effort_time') + serialized = { block_key: { 'badge_progress': block.get('badge_progress', False), @@ -47,8 +55,8 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring 'description': description, 'display_name': display_name, 'due': block.get('due'), - 'effort_activities': block.get('effort_activities'), - 'effort_time': block.get('effort_time'), + 'effort_activities': effort_activities, + 'effort_time': effort_time, 'icon': icon, 'id': block_key, 'lms_web_url': block['lms_web_url'] if enable_links else None, diff --git a/lms/djangoapps/course_home_api/outline/tests/test_view.py b/lms/djangoapps/course_home_api/outline/tests/test_view.py index 2714f3ece514..1666b6df5826 100644 --- a/lms/djangoapps/course_home_api/outline/tests/test_view.py +++ b/lms/djangoapps/course_home_api/outline/tests/test_view.py @@ -279,6 +279,8 @@ def test_proctored_exam(self, mock_summary): assert exam_data['due'] is not None assert exam_data['icon'] == 'fa-foo-bar' + @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSEWARE_OUTLINE_QUESTION_COUNT': True}) + @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSEWARE_OUTLINE_EFFORT_ESTIMATES': True}) def test_assignment(self): course = CourseFactory.create() with self.store.bulk_operations(course.id): diff --git a/lms/envs/common.py b/lms/envs/common.py index b90404d9d61c..591d3cec1dfc 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -518,6 +518,12 @@ # .. toggle_tickets: https://openedx.atlassian.net/browse/OSPR-1320 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER': False, + # Enable courseware outline question count + 'ENABLE_COURSEWARE_OUTLINE_QUESTION_COUNT': False, + + # Enable courseware outline effort estimates + 'ENABLE_COURSEWARE_OUTLINE_EFFORT_ESTIMATES': False, + # Enable organizational email opt-in 'ENABLE_MKTG_EMAIL_OPT_IN': False,