@require_POST
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff')
def list_instructor_tasks(request, course_id):
 course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 problem_location_str = strip_if_string(request.POST.get('problem_location_str', False))
 student = request.POST.get('unique_student_identifier', None)
 if (student is not None):
  student = get_student_from_identifier(student)
 if (student and (not problem_location_str)):
  return HttpResponseBadRequest('unique_student_identifier must accompany problem_location_str')
 if problem_location_str:
  try:
   module_state_key = course_id.make_usage_key_from_deprecated_string(problem_location_str)
  except InvalidKeyError:
   return HttpResponseBadRequest()
  if student:
   tasks = lms.djangoapps.instructor_task.api.get_instructor_task_history(course_id, module_state_key, student)
  else:
   tasks = lms.djangoapps.instructor_task.api.get_instructor_task_history(course_id, module_state_key)
 else:
  tasks = lms.djangoapps.instructor_task.api.get_running_instructor_tasks(course_id)
 response_payload = {'tasks': map(extract_task_features, tasks)}
 return JsonResponse(response_payload)

@ require_POST @ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_level ( 'staff' ) def list_instructor_tasks ( request , course_id ) : course_id = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) problem_location_str = strip_if_string ( request . POST . get ( 'problem_location_str' , False ) ) student = request . POST . get ( 'unique_student_identifier' , None ) if ( student is not None ) : student = get_student_from_identifier ( student ) if ( student and ( not problem_location_str ) ) : return HttpResponseBadRequest ( 'unique_student_identifier must accompany problem_location_str' ) if problem_location_str : try : module_state_key = course_id . make_usage_key_from_deprecated_string ( problem_location_str ) except InvalidKeyError : return HttpResponseBadRequest ( ) if student : tasks = lms . djangoapps . instructor_task . api . get_instructor_task_history ( course_id , module_state_key , student ) else : tasks = lms . djangoapps . instructor_task . api . get_instructor_task_history ( course_id , module_state_key ) else : tasks = lms . djangoapps . instructor_task . api . get_running_instructor_tasks ( course_id ) response_payload = { 'tasks' : map ( extract_task_features , tasks ) } return JsonResponse ( response_payload )
list instructor tasks .