[NEWIMPORT] Partially fix number of hands parsed reporting
This commit is contained in:
parent
b7d9a843bd
commit
ee205c3b29
|
@ -71,6 +71,8 @@ follow : whether to tail -f the input"""
|
||||||
self.out_path = out_path
|
self.out_path = out_path
|
||||||
|
|
||||||
self.processedHands = []
|
self.processedHands = []
|
||||||
|
self.numHands = 0
|
||||||
|
self.numErrors = 0
|
||||||
|
|
||||||
# Tourney object used to store TourneyInfo when called to deal with a Summary file
|
# Tourney object used to store TourneyInfo when called to deal with a Summary file
|
||||||
self.tourney = None
|
self.tourney = None
|
||||||
|
@ -135,17 +137,17 @@ Otherwise, finish at EOF.
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
numHands = 0
|
self.numHands = 0
|
||||||
numErrors = 0
|
self.numErrors = 0
|
||||||
if self.follow:
|
if self.follow:
|
||||||
#TODO: See how summary files can be handled on the fly (here they should be rejected as before)
|
#TODO: See how summary files can be handled on the fly (here they should be rejected as before)
|
||||||
log.info("Tailing '%s'" % self.in_path)
|
log.info("Tailing '%s'" % self.in_path)
|
||||||
for handText in self.tailHands():
|
for handText in self.tailHands():
|
||||||
try:
|
try:
|
||||||
self.processHand(handText)
|
self.processHand(handText)
|
||||||
numHands += 1
|
self.numHands += 1
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors += 1
|
self.numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
log.warning("Exception msg: '%s'" % str(e))
|
log.warning("Exception msg: '%s'" % str(e))
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
|
@ -160,13 +162,13 @@ Otherwise, finish at EOF.
|
||||||
try:
|
try:
|
||||||
self.processedHands.append(self.processHand(handText))
|
self.processedHands.append(self.processHand(handText))
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors += 1
|
self.numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
log.warning("Exception msg: '%s'" % str(e))
|
log.warning("Exception msg: '%s'" % str(e))
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
numHands = len(handsList)
|
self.numHands = len(handsList)
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
log.info("Read %d hands (%d failed) in %.3f seconds" % (numHands, numErrors, endtime - starttime))
|
log.info("Read %d hands (%d failed) in %.3f seconds" % (self.numHands, self.numErrors, endtime - starttime))
|
||||||
else:
|
else:
|
||||||
self.parsedObjectType = "Summary"
|
self.parsedObjectType = "Summary"
|
||||||
summaryParsingStatus = self.readSummaryInfo(handsList)
|
summaryParsingStatus = self.readSummaryInfo(handsList)
|
||||||
|
|
|
@ -427,8 +427,12 @@ class Importer:
|
||||||
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
||||||
|
|
||||||
for hand in handlist:
|
for hand in handlist:
|
||||||
|
#try, except duplicates here?
|
||||||
#hand.prepInsert()
|
#hand.prepInsert()
|
||||||
hand.insert(self.database)
|
hand.insert(self.database)
|
||||||
|
|
||||||
|
errors = getattr(hhc, 'numErrors')
|
||||||
|
stored = getattr(hhc, 'numHands')
|
||||||
else:
|
else:
|
||||||
# conversion didn't work
|
# conversion didn't work
|
||||||
# TODO: appropriate response?
|
# TODO: appropriate response?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user