diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 09b91d362b28..af7ffd0e0f10 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -1459,10 +1459,7 @@ def post(self, request, course_id, csv=False): # pylint: disable=redefined-oute 'enrollment_date', ] - additional_attributes = configuration_helpers.get_value_for_org( - course_key.org, - "additional_student_profile_attributes" - ) + additional_attributes = instructor_analytics_basic.get_additional_student_profile_attributes(course_key) if additional_attributes: # Fail fast: must be list/tuple of strings. if not isinstance(additional_attributes, (list, tuple)): diff --git a/lms/djangoapps/instructor/views/api_v2.py b/lms/djangoapps/instructor/views/api_v2.py index dd399dcb064a..2ecdc2811fb4 100644 --- a/lms/djangoapps/instructor/views/api_v2.py +++ b/lms/djangoapps/instructor/views/api_v2.py @@ -893,10 +893,7 @@ def _generate_enrolled_students_report(self, request, course_key): 'enrollment_date', ] - additional_attributes = configuration_helpers.get_value_for_org( - course_key.org, - "additional_student_profile_attributes" - ) + additional_attributes = instructor_analytics_basic.get_additional_student_profile_attributes(course_key) if additional_attributes: # Fail fast: must be list/tuple of strings. if not isinstance(additional_attributes, (list, tuple)): diff --git a/lms/djangoapps/instructor_analytics/basic.py b/lms/djangoapps/instructor_analytics/basic.py index 5f9dfc8a3203..665e4d92e4c9 100644 --- a/lms/djangoapps/instructor_analytics/basic.py +++ b/lms/djangoapps/instructor_analytics/basic.py @@ -144,10 +144,7 @@ def get_employment_status(self): Returns: tuple: Combined tuple of standard STUDENT_FEATURES and custom attributes """ - additional_attributes = configuration_helpers.get_value_for_org( - course_key.org, - "additional_student_profile_attributes" - ) + additional_attributes = get_additional_student_profile_attributes(course_key) if additional_attributes: return STUDENT_FEATURES + tuple(additional_attributes) @@ -155,6 +152,27 @@ def get_employment_status(self): return STUDENT_FEATURES +def get_additional_student_profile_attributes(course_key): + """ + Return list of additional student profile attributes configured for the course organization. + + This function retrieves any custom student profile attributes that have been configured for + a specific course organization. These attributes can be used to extend the standard set of + student features included in analytics exports. + + Args: + course_key: CourseKey object for the course + + Returns: + list: List of additional student profile attributes configured for the course organization + """ + return configuration_helpers.get_value_for_org( + course_key.org, + "additional_student_profile_attributes", + default=[] + ) + + def get_available_features(course_key): """ Return all available features including custom student attributes for a course.