Skip to content

Commit c3b0a3b

Browse files
feanilclaude
andcommitted
refactor: migrate MAX_ENROLLMENT_INSTR_BUTTONS off FEATURES-as-dict
Flat setting was already being assigned to via the instructor plugin's plugin_settings hook (settings.MAX_ENROLLMENT_INSTR_BUTTONS = 200) — only the readers were still going through settings.FEATURES. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c3bda30 commit c3b0a3b

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

common/djangoapps/student/models/course_enrollment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def is_small_course(self, course_id):
199199
200200
'course_id' is the course_id to return enrollments
201201
"""
202-
max_enrollments = settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS")
202+
max_enrollments = settings.MAX_ENROLLMENT_INSTR_BUTTONS
203203

204204
enrollment_number = super().get_queryset().filter(
205205
course_id=course_id,

lms/djangoapps/instructor/settings/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def plugin_settings(settings):
3030
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/13196
3131
settings.ENABLE_CCX_ANALYTICS_DASHBOARD_URL = False
3232

33-
# .. setting_name: FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS']
33+
# .. setting_name: settings.MAX_ENROLLMENT_INSTR_BUTTONS
3434
# .. setting_default: 200
3535
# .. setting_description: Disable instructor dashboard buttons for downloading course data
3636
# when enrollment exceeds this number. The number indicates the maximum allowed enrollments

lms/djangoapps/instructor/tests/test_api_v2.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ def test_open_responses_tab_with_openassessment_blocks(self, mock_modulestore):
450450

451451
self.assertIn('open_responses', tab_ids) # noqa: PT009
452452

453-
@override_settings(ENABLE_SPECIAL_EXAMS=True)
454-
@patch.dict('django.conf.settings.FEATURES', {'MAX_ENROLLMENT_INSTR_BUTTONS': 200})
453+
@override_settings(ENABLE_SPECIAL_EXAMS=True, MAX_ENROLLMENT_INSTR_BUTTONS=200)
455454
def test_special_exams_tab_with_proctored_exams_enabled(self):
456455
"""
457456
Test that special_exams tab appears when course has proctored exams enabled.
@@ -461,8 +460,7 @@ def test_special_exams_tab_with_proctored_exams_enabled(self):
461460

462461
self.assertIn('special_exams', tab_ids) # noqa: PT009
463462

464-
@override_settings(ENABLE_SPECIAL_EXAMS=True)
465-
@patch.dict('django.conf.settings.FEATURES', {'MAX_ENROLLMENT_INSTR_BUTTONS': 200})
463+
@override_settings(ENABLE_SPECIAL_EXAMS=True, MAX_ENROLLMENT_INSTR_BUTTONS=200)
466464
def test_special_exams_tab_with_timed_exams_enabled(self):
467465
"""
468466
Test that special_exams tab appears when course has timed exams enabled.
@@ -479,9 +477,9 @@ def test_special_exams_tab_with_timed_exams_enabled(self):
479477
tab_ids = [tab['tab_id'] for tab in tabs]
480478
self.assertIn('special_exams', tab_ids) # noqa: PT009
481479

480+
@override_settings(MAX_ENROLLMENT_INSTR_BUTTONS=200)
482481
@patch('lms.djangoapps.instructor.views.serializers_v2.CertificateGenerationConfiguration.current')
483-
@patch('django.conf.settings.FEATURES', {'ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE': True,
484-
'MAX_ENROLLMENT_INSTR_BUTTONS': 200})
482+
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE': True})
485483
def test_certificates_tab_for_instructor_when_enabled(self, mock_cert_config):
486484
"""
487485
Test that certificates tab appears for instructors when certificate management is enabled.

lms/djangoapps/instructor/views/gradebook_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def get_grade_book_page(request, course, course_key):
106106
def spoc_gradebook(request, course_id):
107107
"""
108108
Show the gradebook for this course:
109-
- Only shown for courses with enrollment < settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS")
109+
- Only shown for courses with enrollment < settings.MAX_ENROLLMENT_INSTR_BUTTONS
110110
- Only displayed to course staff
111111
"""
112112
course_key = CourseKey.from_string(course_id)

0 commit comments

Comments
 (0)