def _get_block_summary_totals(course_data):
 block_summary_counts = {}
 unique_course_counts = {}
 for course in course_data:
  block_counts = course.get(BLOCK_COUNTS_KEY)
  for (count_label, value) in block_counts.items():
   unique = 0
   if (value > 0):
    unique = 1
   if (count_label in block_summary_counts):
    block_summary_counts[count_label] += value
    unique_course_counts[count_label] += unique
   else:
    block_summary_counts[count_label] = value
    unique_course_counts[count_label] = unique
 return (block_summary_counts, unique_course_counts)

def _get_block_summary_totals ( course_data ) : block_summary_counts = { } unique_course_counts = { } for course in course_data : block_counts = course . get ( BLOCK_COUNTS_KEY ) for ( count_label , value ) in block_counts . items ( ) : unique = 0 if ( value > 0 ) : unique = 1 if ( count_label in block_summary_counts ) : block_summary_counts [ count_label ] += value unique_course_counts [ count_label ] += unique else : block_summary_counts [ count_label ] = value unique_course_counts [ count_label ] = unique return ( block_summary_counts , unique_course_counts )
totals the xblock types included in the course data and returns those counts by type arguments: course_data : a list of course_data objects returns: dict: containing the total number of blocks by type <block_type>: <count> .