Fixed imported hands accounting

This commit is contained in:
grindi 2009-08-06 21:26:55 +04:00
parent 30ae9da2df
commit 25be578e7d

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #This program is free software: you can redistribute it and/or modify
@ -95,12 +96,14 @@ Otherwise, finish at eof.
else: else:
handsList = self.allHandsAsList() handsList = self.allHandsAsList()
logging.info("Parsing %d hands" % len(handsList)) logging.info("Parsing %d hands" % len(handsList))
nBadHangs = 0
for handText in handsList: for handText in handsList:
try: try:
self.processedHands.append(self.processHand(handText)) self.processedHands.append(self.processHand(handText))
except Exception, e: # TODO: it's better to write something like HhcEception here except Exception, e: # TODO: it's better to replace it with s-t like HhcEception
nBadHangs += 1
logging.error("Caught exception while parsing hand: %s" % str(e)) logging.error("Caught exception while parsing hand: %s" % str(e))
numHands= len(handsList) numHands = len(handsList) - nBadHangs
endtime = time.time() endtime = time.time()
print "read %d hands in %.3f seconds" % (numHands, endtime - starttime) print "read %d hands in %.3f seconds" % (numHands, endtime - starttime)
if self.out_fh != sys.stdout: if self.out_fh != sys.stdout: