@ -66,6 +66,7 @@ else:
out , err = process . communicate ( )
out , err = process . communicate ( )
if err == None :
if err == None :
serverResults = { }
serverResults = { }
serverScores = { }
results = json . loads ( out )
results = json . loads ( out )
for result in results :
for result in results :
#2015-08-08T12:26:42.894Z
#2015-08-08T12:26:42.894Z
@ -74,7 +75,8 @@ else:
key = str ( result [ ' problemId ' ] ) + " . " + str ( result [ ' seed ' ] )
key = str ( result [ ' problemId ' ] ) + " . " + str ( result [ ' seed ' ] )
if not key in serverResults or serverResults [ key ] [ ' createdAt ' ] < result [ ' createdAt ' ] :
if not key in serverResults or serverResults [ key ] [ ' createdAt ' ] < result [ ' createdAt ' ] :
serverResults [ key ] = result
serverResults [ key ] = result
#print results
if not key in serverScores or serverScores [ key ] < result [ ' score ' ] :
serverScores [ key ] = result
tags = { }
tags = { }
for serverResult in serverResults :
for serverResult in serverResults :
if not serverResults [ serverResult ] [ ' tag ' ] in tags :
if not serverResults [ serverResult ] [ ' tag ' ] in tags :
@ -101,6 +103,11 @@ else:
print bcolors . WARNING + str ( solutionToSend [ ' problemId ' ] ) + " " + str ( solutionToSend [ ' seed ' ] ) + " solution evaluation pending " + bcolors . ENDC
print bcolors . WARNING + str ( solutionToSend [ ' problemId ' ] ) + " " + str ( solutionToSend [ ' seed ' ] ) + " solution evaluation pending " + bcolors . ENDC
elif scores [ key ] != serverResults [ key ] [ ' score ' ] :
elif scores [ key ] != serverResults [ key ] [ ' score ' ] :
print bcolors . FAIL + str ( solutionToSend [ ' problemId ' ] ) + " " + str ( solutionToSend [ ' seed ' ] ) + " score differ: " + str ( scores [ key ] ) + " != " + str ( serverResults [ key ] [ ' score ' ] ) + " (server) " + bcolors . ENDC
print bcolors . FAIL + str ( solutionToSend [ ' problemId ' ] ) + " " + str ( solutionToSend [ ' seed ' ] ) + " score differ: " + str ( scores [ key ] ) + " != " + str ( serverResults [ key ] [ ' score ' ] ) + " (server) " + bcolors . ENDC
elif serverScores [ key ] [ ' score ' ] > scores [ key ] :
print bcolors . FAIL + str ( solutionToSend [ ' problemId ' ] ) + " " + str ( solutionToSend [ ' seed ' ] ) + " better solution alredy exists on the server: " + serverScores [ key ] [ ' solutions ' ] + bcolors . ENDC
print 32432432
elif not key in serverScores :
print " cazziammolla "
print " Tags statistics: "
print " Tags statistics: "
for tag in tags :
for tag in tags :
print " %s : %d " % ( tag , tags [ tag ] )
print " %s : %d " % ( tag , tags [ tag ] )