def get_group_counts(group_by, header_groups=None, fixed_headers=None, extra_select_fields=None, **filter_data):
 query = models.TestView.objects.get_query_set_with_joins(filter_data)
 query = models.TestView.query_objects(filter_data, initial_query=query, apply_presentation=False)
 (count_alias, count_sql) = models.TestView.objects.get_count_sql(query)
 query = query.extra(select={count_alias: count_sql})
 if extra_select_fields:
  query = query.extra(select=extra_select_fields)
 query = models.TestView.apply_presentation(query, filter_data)
 group_processor = tko_rpc_utils.GroupDataProcessor(query, group_by, (header_groups or []), (fixed_headers or {}))
 group_processor.process_group_dicts()
 return rpc_utils.prepare_for_serialization(group_processor.get_info_dict())

def get_group_counts ( group_by , header_groups = None , fixed_headers = None , extra_select_fields = None , ** filter_data ) : query = models . TestView . objects . get_query_set_with_joins ( filter_data ) query = models . TestView . query_objects ( filter_data , initial_query = query , apply_presentation = False ) ( count_alias , count_sql ) = models . TestView . objects . get_count_sql ( query ) query = query . extra ( select = { count_alias : count_sql } ) if extra_select_fields : query = query . extra ( select = extra_select_fields ) query = models . TestView . apply_presentation ( query , filter_data ) group_processor = tko_rpc_utils . GroupDataProcessor ( query , group_by , ( header_groups or [ ] ) , ( fixed_headers or { } ) ) group_processor . process_group_dicts ( ) return rpc_utils . prepare_for_serialization ( group_processor . get_info_dict ( ) )
queries against testview grouping by the specified fields and computings counts for each group .