Add the 'meta' column from the UserProfile table to the CSV download

add special case logic to get the 'meta' field into the downloaded CSV

wip

wip
This commit is contained in:
Chris Dodge
2014-09-22 11:53:49 -04:00
parent 96ac506f6f
commit f34a1c9d11
2 changed files with 12 additions and 6 deletions

View File

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

View File

@@ -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]