Skip to content

Commit

Permalink
Merge pull request #233 from CUCWD/feature.maple/ztraboo/hide-course-…
Browse files Browse the repository at this point in the history
…outline-questions-and-estimates

Remove course outline question count and estimates by default for maple release.
  • Loading branch information
ztraboo authored Apr 12, 2024
2 parents b65a19b + ccfadf5 commit 55925b8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
14 changes: 11 additions & 3 deletions lms/djangoapps/course_home_api/outline/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand All @@ -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),
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
7 changes: 6 additions & 1 deletion requirements/edx/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55925b8

Please sign in to comment.