From 141b88ecfd9f045d2c108ba684e5032e868e932b Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 20 Feb 2010 17:49:03 +0000 Subject: [PATCH] stop hudcache updating again when importing duplicate hands --- pyfpdb/Hand.py | 3 +++ pyfpdb/fpdb_import.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 73dd7600..e54354e8 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -125,6 +125,7 @@ class Hand(object): # currency symbol for this hand self.sym = self.SYMBOL[self.gametype['currency']] # save typing! delete this attr when done self.pot.setSym(self.sym) + self.is_duplicate = False # i.e. don't update hudcache if true def __str__(self): vars = ( ("BB", self.bb), @@ -236,6 +237,7 @@ db: a connected Database object""" # TourneysPlayers else: log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo']) + self.is_duplicate = True # i.e. don't update hudcache raise FpdbHandDuplicate(hh['siteHandNo']) def updateHudCache(self, db): @@ -669,6 +671,7 @@ class HoldemOmahaHand(Hand): if self.maxseats is None: self.maxseats = hhc.guessMaxSeats(self) hhc.readOther(self) + #print "\nHand:\n"+str(self) elif builtFrom == "DB": if handid is not None: self.select(handid) # Will need a handId diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 95ffd525..689858e0 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -456,7 +456,7 @@ class Importer: # FIXME: Need to test for bulk import that isn't rebuilding the cache if self.callHud: for hand in handlist: - if hand is not None: + if hand is not None and not hand.is_duplicate: hand.updateHudCache(self.database) self.database.commit()