Merge pull request #5358 from edx/cdodge/add-meta-to-profile-download
Add the 'meta' column from the UserProfile table to the CSV download
This commit is contained in:
@@ -692,11 +692,16 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=W06
|
||||
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
|
||||
|
||||
available_features = instructor_analytics.basic.AVAILABLE_FEATURES
|
||||
query_features = [
|
||||
'id', 'username', 'name', 'email', 'language', 'location',
|
||||
'year_of_birth', 'gender', 'level_of_education', 'mailing_address',
|
||||
'goals',
|
||||
]
|
||||
|
||||
# Allow for microsites to be able to define additional columns (e.g. )
|
||||
query_features = microsite.get_value('student_profile_download_fields')
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
STUDENT_FEATURES = ('id', 'username', 'first_name', 'last_name', 'is_staff', 'email')
|
||||
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_FEATURES = ('purchase_time',)
|
||||
|
||||
@@ -150,6 +150,7 @@ def enrolled_students_features(course_id, features):
|
||||
profile_dict = dict((feature, getattr(profile, feature))
|
||||
for feature in profile_features)
|
||||
student_dict.update(profile_dict)
|
||||
|
||||
return student_dict
|
||||
|
||||
return [extract_student(student, features) for student in students]
|
||||
|
||||
Reference in New Issue
Block a user