diff --git a/lms/djangoapps/course_home_api/outline/serializers.py b/lms/djangoapps/course_home_api/outline/serializers.py index 2195b56d7910..e2487333c2f8 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): 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): 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): '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 6c787ffa0850..fd36584f6abc 100644 --- a/lms/djangoapps/course_home_api/outline/tests/test_view.py +++ b/lms/djangoapps/course_home_api/outline/tests/test_view.py @@ -312,6 +312,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 760a07284b92..33b061199c07 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, diff --git a/requirements/edx/base.in b/requirements/edx/base.in index 70bb3bcce612..994344089d27 100644 --- a/requirements/edx/base.in +++ b/requirements/edx/base.in @@ -123,7 +123,12 @@ openedx-events # Open edX Events from Hooks Extension Frame ora2 piexif # Exif image metadata manipulation, used in the profile_images app Pillow # Image manipulation library; used for course assets, profile images, invoice PDFs, etc. -py2neo # Driver for converting Python modulestore structures to Neo4j's schema (for Coursegraph). + +# Driver for converting Python modulestore structures to Neo4j's schema (for Coursegraph). +# Using the fork because official package has been removed from PyPI/GitHub +# Follow up issue to remove this fork: https://github.com/openedx/edx-platform/issues/33456 +https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz + pycountry pycryptodomex pygments # Used to support colors in paver command output diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 96e73ecbcf79..2beed4fa28a0 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -725,7 +725,7 @@ psutil==5.8.0 # via # -r requirements/edx/paver.txt # edx-django-utils -py2neo==2021.2.3 +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.in diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 89be24b0fe9c..2ce356821338 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -993,7 +993,7 @@ py==1.10.0 # pytest # pytest-forked # tox -py2neo==2021.2.3 +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/testing.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 2c1127cf3e14..74038d7388c4 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -928,11 +928,8 @@ psutil==5.8.0 # pact-python # pytest-xdist py==1.10.0 - # via - # pytest - # pytest-forked - # tox -py2neo==2021.2.3 + # via tox +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt