#NEWLINE# def update_rank( self , submission ) : #NEWLINE# #INDENT# if ( ( not submission . contest_id ) or ( submission . contest_id != self . contest_id ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Error submission type' ) #NEWLINE# #UNINDENT# if ( submission . result == result [ 'system_error' ] ) : #NEWLINE# #INDENT# logger . warning ( ( ( 'submission ' + submission . id ) + ' result is system error, update rank operation is ignored' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( str ( submission . problem_id ) in self . submission_info ) : #NEWLINE# #INDENT# info = submission . submission_info [ str ( submission . problem_id ) ] #NEWLINE# if info [ 'is_ac' ] : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . total_submission_number += 1 #NEWLINE# if ( submission . result == result [ 'accepted' ] ) : #NEWLINE# #INDENT# self . total_ac_number += 1 #NEWLINE# info [ 'is_ac' ] = True #NEWLINE# info [ 'ac_time' ] = ( submission . create_time - self . contest . start_time ) . total_seconds ( ) #NEWLINE# self . total_time += ( info [ 'ac_time' ] + ( ( info [ 'error_number' ] * 20 ) * 60 ) ) #NEWLINE# problem = ContestProblem . objects . get ( id = submission . problem_id ) #NEWLINE# if ( problem . total_accepted_number == 1 ) : #NEWLINE# #INDENT# info [ 'is_first_ac' ] = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# info [ 'error_number' ] += 1 #NEWLINE# info [ 'is_ac' ] = False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . total_submission_number += 1 #NEWLINE# info = { #NEWLINE# #INDENT# 'is_ac' : False , #NEWLINE# 'ac_time' : 0 , #NEWLINE# 'error_number' : 0 , #NEWLINE# 'is_first_ac' : False , #NEWLINE# #UNINDENT# } #NEWLINE# if ( submission . result == result [ 'accepted' ] ) : #NEWLINE# #INDENT# self . total_ac_number += 1 #NEWLINE# info [ 'is_ac' ] = True #NEWLINE# info [ 'ac_time' ] = ( submission . create_time - self . contest . start_time ) . total_seconds ( ) #NEWLINE# self . total_time += info [ 'ac_time' ] #NEWLINE# problem = ContestProblem . objects . get ( id = submission . problem_id ) #NEWLINE# if ( problem . total_accepted_number == 1 ) : #NEWLINE# #INDENT# info [ 'is_first_ac' ] = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# info [ 'is_ac' ] = False #NEWLINE# info [ 'error_number' ] = 1 #NEWLINE# #UNINDENT# #UNINDENT# self . submission_info [ str ( submission . problem_id ) ] = info #NEWLINE# self . save ( )