#NEWLINE# def get_team_member_solve_stats( eligible = True ) : #NEWLINE# #INDENT# db = api . api . common . get_conn ( ) #NEWLINE# teams = api . team . get_all_teams ( show_ineligible = ( not eligible ) ) #NEWLINE# user_breakdowns = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for t in teams : #NEWLINE# #INDENT# uid_map = defaultdict ( ( lambda : defaultdict ( int ) ) ) #NEWLINE# members = api . team . get_team_members ( tid = t [ 'tid' ] , show_disabled = False ) #NEWLINE# subs = db . submissions . find ( { #NEWLINE# #INDENT# 'tid' : t [ 'tid' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# for sub in subs : #NEWLINE# #INDENT# uid = sub [ 'uid' ] #NEWLINE# uid_map [ uid ] [ 'submits' ] += 1 #NEWLINE# if ( uid_map [ uid ] [ 'times' ] == 0 ) : #NEWLINE# #INDENT# uid_map [ uid ] [ 'times' ] = list ( ) #NEWLINE# #UNINDENT# uid_map [ uid ] [ 'times' ] . append ( sub [ 'timestamp' ] ) #NEWLINE# if sub [ 'correct' ] : #NEWLINE# #INDENT# uid_map [ uid ] [ 'correct' ] += 1 #NEWLINE# uid_map [ uid ] [ sub [ 'category' ] ] += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# uid_map [ uid ] [ 'incorrect' ] += 1 #NEWLINE# #UNINDENT# #UNINDENT# user_breakdowns [ t [ 'tid' ] ] = uid_map #NEWLINE# for member in t : #NEWLINE# #INDENT# if ( member [ 'uid' ] not in uid_map ) : #NEWLINE# #INDENT# uid_map [ member [ 'uid' ] ] = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return user_breakdowns