def get_assignments_for_problem(problem_descriptor, user_id, course_key):
 locations = []
 current_descriptor = problem_descriptor
 while current_descriptor:
  locations.append(current_descriptor.location)
  current_descriptor = current_descriptor.get_parent()
 assignments = GradedAssignment.objects.filter(user=user_id, course_key=course_key, usage_key__in=locations)
 return assignments

def get_assignments_for_problem ( problem_descriptor , user_id , course_key ) : locations = [ ] current_descriptor = problem_descriptor while current_descriptor : locations . append ( current_descriptor . location ) current_descriptor = current_descriptor . get_parent ( ) assignments = GradedAssignment . objects . filter ( user = user_id , course_key = course_key , usage_key__in = locations ) return assignments
trace the parent hierarchy from a given problem to find all blocks that correspond to graded assignment launches for this user .