[NEWIMPORT] Stop duplicate hands from crashing import
This commit is contained in:
parent
83f06c35cc
commit
aee9a7339c
|
@ -1672,6 +1672,15 @@ class Database:
|
||||||
# street4CheckCallRaiseChance,
|
# street4CheckCallRaiseChance,
|
||||||
# street4CheckCallRaiseDone)
|
# street4CheckCallRaiseDone)
|
||||||
|
|
||||||
|
def isDuplicate(self, gametypeID, siteHandNo):
|
||||||
|
dup = False
|
||||||
|
c = self.get_cursor()
|
||||||
|
c.execute(self.sql.query['isAlreadyInDB'], (gametypeID, siteHandNo))
|
||||||
|
result = c.fetchall()
|
||||||
|
if len(result) > 0:
|
||||||
|
dup = True
|
||||||
|
return dup
|
||||||
|
|
||||||
def getGameTypeId(self, siteid, game):
|
def getGameTypeId(self, siteid, game):
|
||||||
c = self.get_cursor()
|
c = self.get_cursor()
|
||||||
#FIXME: Fixed for NL at the moment
|
#FIXME: Fixed for NL at the moment
|
||||||
|
@ -1711,6 +1720,13 @@ class Database:
|
||||||
q = "SELECT name, id FROM Players WHERE siteid=%s and name=%s"
|
q = "SELECT name, id FROM Players WHERE siteid=%s and name=%s"
|
||||||
q = q.replace('%s', self.sql.query['placeholder'])
|
q = q.replace('%s', self.sql.query['placeholder'])
|
||||||
|
|
||||||
|
#NOTE/FIXME?: MySQL has ON DUPLICATE KEY UPDATE
|
||||||
|
#Usage:
|
||||||
|
# INSERT INTO `tags` (`tag`, `count`)
|
||||||
|
# VALUES ($tag, 1)
|
||||||
|
# ON DUPLICATE KEY UPDATE `count`=`count`+1;
|
||||||
|
|
||||||
|
|
||||||
#print "DEBUG: name: %s site: %s" %(name, site_id)
|
#print "DEBUG: name: %s site: %s" %(name, site_id)
|
||||||
|
|
||||||
c.execute (q, (site_id, name))
|
c.execute (q, (site_id, name))
|
||||||
|
|
|
@ -210,24 +210,24 @@ db: a connected fpdb_db object"""
|
||||||
#####
|
#####
|
||||||
# End prep functions
|
# End prep functions
|
||||||
#####
|
#####
|
||||||
|
|
||||||
# HandsActions - all actions for all players for all streets - self.actions
|
|
||||||
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
|
||||||
|
|
||||||
# Hands - Summary information of hand indexed by handId - gameinfo
|
|
||||||
hh = self.stats.getHands()
|
hh = self.stats.getHands()
|
||||||
hh['gameTypeId'] = gtid
|
|
||||||
# seats TINYINT NOT NULL,
|
|
||||||
hh['seats'] = len(sqlids)
|
|
||||||
|
|
||||||
#print hh
|
if not db.isDuplicate(gtid, hh['siteHandNo']):
|
||||||
handid = db.storeHand(hh)
|
# Hands - Summary information of hand indexed by handId - gameinfo
|
||||||
# HandsPlayers - ? ... Do we fix winnings?
|
hh['gameTypeId'] = gtid
|
||||||
db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers())
|
# seats TINYINT NOT NULL,
|
||||||
# Tourneys ?
|
hh['seats'] = len(sqlids)
|
||||||
# TourneysPlayers
|
|
||||||
|
|
||||||
pass
|
handid = db.storeHand(hh)
|
||||||
|
db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers())
|
||||||
|
# HandsActions - all actions for all players for all streets - self.actions
|
||||||
|
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
||||||
|
# Tourneys ?
|
||||||
|
# TourneysPlayers
|
||||||
|
else:
|
||||||
|
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
|
||||||
|
#Raise Duplicate exception?
|
||||||
|
pass
|
||||||
|
|
||||||
def select(self, handId):
|
def select(self, handId):
|
||||||
""" Function to create Hand object from database """
|
""" Function to create Hand object from database """
|
||||||
|
|
Loading…
Reference in New Issue
Block a user