def get_d3_sequential_open_distrib(course_id):
 sequential_open_distrib = get_sequential_open_distrib(course_id)
 d3_data = []
 course = modulestore().get_course(course_id, depth=2)
 for section in course.get_children():
  curr_section = {}
  curr_section['display_name'] = own_metadata(section).get('display_name', '')
  data = []
  c_subsection = 0
  for subsection in section.get_children():
   c_subsection += 1
   subsection_name = own_metadata(subsection).get('display_name', '')
   num_students = 0
   if (subsection.location in sequential_open_distrib):
    num_students = sequential_open_distrib[subsection.location]
   stack_data = []
   tooltip = {'type': 'subsection', 'num_students': num_students, 'subsection_num': c_subsection, 'subsection_name': subsection_name}
   stack_data.append({'color': 0, 'value': num_students, 'tooltip': tooltip, 'module_url': subsection.location.to_deprecated_string()})
   subsection = {'xValue': 'SS {0}'.format(c_subsection), 'stackData': stack_data}
   data.append(subsection)
  curr_section['data'] = data
  d3_data.append(curr_section)
 return d3_data

def get_d3_sequential_open_distrib ( course_id ) : sequential_open_distrib = get_sequential_open_distrib ( course_id ) d3_data = [ ] course = modulestore ( ) . get_course ( course_id , depth = 2 ) for section in course . get_children ( ) : curr_section = { } curr_section [ 'display_name' ] = own_metadata ( section ) . get ( 'display_name' , '' ) data = [ ] c_subsection = 0 for subsection in section . get_children ( ) : c_subsection += 1 subsection_name = own_metadata ( subsection ) . get ( 'display_name' , '' ) num_students = 0 if ( subsection . location in sequential_open_distrib ) : num_students = sequential_open_distrib [ subsection . location ] stack_data = [ ] tooltip = { 'type' : 'subsection' , 'num_students' : num_students , 'subsection_num' : c_subsection , 'subsection_name' : subsection_name } stack_data . append ( { 'color' : 0 , 'value' : num_students , 'tooltip' : tooltip , 'module_url' : subsection . location . to_deprecated_string ( ) } ) subsection = { 'xValue' : 'SS {0}' . format ( c_subsection ) , 'stackData' : stack_data } data . append ( subsection ) curr_section [ 'data' ] = data d3_data . append ( curr_section ) return d3_data
returns how many students opened a sequential/subsection for each section .