def upload_problem_responses_csv(_xmodule_instance_args, _entry_id, course_id, task_input, action_name):
 start_time = time()
 start_date = datetime.now(UTC)
 num_reports = 1
 task_progress = TaskProgress(action_name, num_reports, start_time)
 current_step = {'step': 'Calculating students answers to problem'}
 task_progress.update_task_state(extra_meta=current_step)
 problem_location = task_input.get('problem_location')
 student_data = list_problem_responses(course_id, problem_location)
 features = ['username', 'state']
 (header, rows) = format_dictlist(student_data, 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)
 problem_location = re.sub('[:/]', '_', problem_location)
 csv_name = 'student_state_from_{}'.format(problem_location)
 upload_csv_to_report_store(rows, csv_name, course_id, start_date)
 return task_progress.update_task_state(extra_meta=current_step)

def upload_problem_responses_csv ( _xmodule_instance_args , _entry_id , course_id , task_input , action_name ) : start_time = time ( ) start_date = datetime . now ( UTC ) num_reports = 1 task_progress = TaskProgress ( action_name , num_reports , start_time ) current_step = { 'step' : 'Calculating students answers to problem' } task_progress . update_task_state ( extra_meta = current_step ) problem_location = task_input . get ( 'problem_location' ) student_data = list_problem_responses ( course_id , problem_location ) features = [ 'username' , 'state' ] ( header , rows ) = format_dictlist ( student_data , 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 ) problem_location = re . sub ( '[:/]' , '_' , problem_location ) csv_name = 'student_state_from_{}' . format ( problem_location ) upload_csv_to_report_store ( rows , csv_name , course_id , start_date ) return task_progress . update_task_state ( extra_meta = current_step )
for a given course_id .