def upload_students_csv(_xmodule_instance_args, _entry_id, course_id, task_input, action_name):
 start_time = time()
 start_date = datetime.now(UTC)
 enrolled_students = CourseEnrollment.objects.users_enrolled_in(course_id)
 task_progress = TaskProgress(action_name, enrolled_students.count(), start_time)
 current_step = {'step': 'Calculating Profile Info'}
 task_progress.update_task_state(extra_meta=current_step)
 query_features = task_input
 student_data = enrolled_students_features(course_id, query_features)
 (header, rows) = format_dictlist(student_data, query_features)
 task_progress.attempted = task_progress.succeeded = len(rows)
 task_progress.skipped = (task_progress.total - task_progress.attempted)
 rows.insert(0, header)
 current_step = {'step': 'Uploading CSV'}
 task_progress.update_task_state(extra_meta=current_step)
 upload_csv_to_report_store(rows, 'student_profile_info', course_id, start_date)
 return task_progress.update_task_state(extra_meta=current_step)

def upload_students_csv ( _xmodule_instance_args , _entry_id , course_id , task_input , action_name ) : start_time = time ( ) start_date = datetime . now ( UTC ) enrolled_students = CourseEnrollment . objects . users_enrolled_in ( course_id ) task_progress = TaskProgress ( action_name , enrolled_students . count ( ) , start_time ) current_step = { 'step' : 'Calculating Profile Info' } task_progress . update_task_state ( extra_meta = current_step ) query_features = task_input student_data = enrolled_students_features ( course_id , query_features ) ( header , rows ) = format_dictlist ( student_data , query_features ) task_progress . attempted = task_progress . succeeded = len ( rows ) task_progress . skipped = ( task_progress . total - task_progress . attempted ) rows . insert ( 0 , header ) current_step = { 'step' : 'Uploading CSV' } task_progress . update_task_state ( extra_meta = current_step ) upload_csv_to_report_store ( rows , 'student_profile_info' , course_id , start_date ) return task_progress . update_task_state ( extra_meta = current_step )
for a given course_id .