Commit d8e5fca3 by chrisndodge

Merge pull request #5358 from edx/cdodge/add-meta-to-profile-download

Add the 'meta' column from the UserProfile table to the CSV download
parents 04ed6c9c f34a1c9d
...@@ -692,11 +692,16 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=W06 ...@@ -692,11 +692,16 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=W06
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id) course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
available_features = instructor_analytics.basic.AVAILABLE_FEATURES available_features = instructor_analytics.basic.AVAILABLE_FEATURES
query_features = [
'id', 'username', 'name', 'email', 'language', 'location', # Allow for microsites to be able to define additional columns (e.g. )
'year_of_birth', 'gender', 'level_of_education', 'mailing_address', query_features = microsite.get_value('student_profile_download_fields')
'goals',
] if not query_features:
query_features = [
'id', 'username', 'name', 'email', 'language', 'location',
'year_of_birth', 'gender', 'level_of_education', 'mailing_address',
'goals'
]
student_data = instructor_analytics.basic.enrolled_students_features(course_id, query_features) student_data = instructor_analytics.basic.enrolled_students_features(course_id, query_features)
......
...@@ -11,7 +11,7 @@ from django.core.exceptions import ObjectDoesNotExist ...@@ -11,7 +11,7 @@ from django.core.exceptions import ObjectDoesNotExist
STUDENT_FEATURES = ('id', 'username', 'first_name', 'last_name', 'is_staff', 'email') STUDENT_FEATURES = ('id', 'username', 'first_name', 'last_name', 'is_staff', 'email')
PROFILE_FEATURES = ('name', 'language', 'location', 'year_of_birth', 'gender', PROFILE_FEATURES = ('name', 'language', 'location', 'year_of_birth', 'gender',
'level_of_education', 'mailing_address', 'goals') 'level_of_education', 'mailing_address', 'goals', 'meta')
ORDER_ITEM_FEATURES = ('list_price', 'unit_cost', 'order_id') ORDER_ITEM_FEATURES = ('list_price', 'unit_cost', 'order_id')
ORDER_FEATURES = ('purchase_time',) ORDER_FEATURES = ('purchase_time',)
...@@ -150,6 +150,7 @@ def enrolled_students_features(course_id, features): ...@@ -150,6 +150,7 @@ def enrolled_students_features(course_id, features):
profile_dict = dict((feature, getattr(profile, feature)) profile_dict = dict((feature, getattr(profile, feature))
for feature in profile_features) for feature in profile_features)
student_dict.update(profile_dict) student_dict.update(profile_dict)
return student_dict return student_dict
return [extract_student(student, features) for student in students] return [extract_student(student, features) for student in students]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment