#NEWLINE# def generate( self ) : #NEWLINE# #INDENT# reviewers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# now = time . time ( ) #NEWLINE# for project in table . projects : #NEWLINE# #INDENT# query = OperationQuery ( self . client , { #NEWLINE# #INDENT# 'project' : [ project ] , #NEWLINE# #UNINDENT# } , patches = OperationQuery . PATCHES_ALL , approvals = True ) #NEWLINE# def querycb( change ) : #NEWLINE# #INDENT# for patch in change . patches : #NEWLINE# #INDENT# for approval in patch . approvals : #NEWLINE# #INDENT# if ( approval . action == ModelApproval . ACTION_VERIFIED ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# user = approval . user #NEWLINE# if ( ( user is None ) or ( user . username is None ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# username = user . username #NEWLINE# if ( username not in reviewers ) : #NEWLINE# #INDENT# reviewers [ username ] = { #NEWLINE# #INDENT# 'total' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# agesecs = approval . get_age ( now ) #NEWLINE# ageweeks = ( int ( ( agesecs / ( ( ( 60 * 60 ) * 24 ) * 7 ) ) ) + 1 ) #NEWLINE# key = ( 'week%d' % ageweeks ) #NEWLINE# if ( key not in reviewers [ username ] ) : #NEWLINE# #INDENT# reviewers [ username ] [ key ] = 0 #NEWLINE# #UNINDENT# reviewers [ username ] [ key ] = ( reviewers [ username ] [ key ] + 1 ) #NEWLINE# if ( ageweeks <= 52 ) : #NEWLINE# #INDENT# reviewers [ username ] [ 'total' ] = ( reviewers [ username ] [ 'total' ] + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# query . run ( querycb ) #NEWLINE# #UNINDENT# table = self . new_table ( 'Daily review rates per week' ) #NEWLINE# for reviewer in reviewers . keys ( ) : #NEWLINE# #INDENT# userteam = '' #NEWLINE# for team in self . teams . keys ( ) : #NEWLINE# #INDENT# if ( reviewer in self . teams [ team ] ) : #NEWLINE# #INDENT# userteam = team #NEWLINE# #UNINDENT# #UNINDENT# table . add_row ( [ reviewer , userteam , reviewers [ reviewer ] ] ) #NEWLINE# #UNINDENT# return table