[NEWIMPORT] Add function to update hudcache for Hand
This commit is contained in:
parent
a2d0657b3a
commit
a0475aa4db
|
@ -586,6 +586,7 @@ class Database:
|
|||
elif not name.lower() in stat_dict[playerid]:
|
||||
stat_dict[playerid][name.lower()] = val
|
||||
elif name.lower() not in ('hand_id', 'player_id', 'seat', 'screen_name', 'seats'):
|
||||
#print "DEBUG: stat_dict[%s][%s]: %s" %(playerid, name.lower(), val)
|
||||
stat_dict[playerid][name.lower()] += val
|
||||
n += 1
|
||||
if n >= 10000: break # todo: don't think this is needed so set nice and high
|
||||
|
@ -1490,194 +1491,109 @@ class Database:
|
|||
c = self.get_cursor()
|
||||
c.executemany(q, inserts)
|
||||
|
||||
def storeHudCache(self, gid, pid, hc):
|
||||
"""Update cached statistics. If update fails because no record exists, do an insert.
|
||||
Can't use array updates here (not easily anyway) because we need to insert any rows
|
||||
that don't get updated."""
|
||||
def storeHudCache(self, gid, pids, starttime, pdata):
|
||||
"""Update cached statistics. If update fails because no record exists, do an insert."""
|
||||
|
||||
if self.use_date_in_hudcache:
|
||||
#print "key =", "d%02d%02d%02d " % (hand_start_time.year-2000, hand_start_time.month, hand_start_time.day)
|
||||
styleKey = "d%02d%02d%02d" % (hand_start_time.year-2000, hand_start_time.month, hand_start_time.day)
|
||||
if self.use_date_in_hudcache:
|
||||
styleKey = datetime.strftime(starttime, 'd%y%m%d')
|
||||
#styleKey = "d%02d%02d%02d" % (hand_start_time.year-2000, hand_start_time.month, hand_start_time.day)
|
||||
else:
|
||||
# hard-code styleKey as 'A000000' (all-time cache, no key) for now
|
||||
styleKey = 'A000000'
|
||||
|
||||
update_hudcache = self.sql.query['update_hudcache']
|
||||
update_hudcache = update_hudcache.replace('%s', self.sql.query['placeholder'])
|
||||
insert_hudcache = self.sql.query['insert_hudcache']
|
||||
insert_hudcache = insert_hudcache.replace('%s', self.sql.query['placeholder'])
|
||||
|
||||
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
|
||||
inserts = []
|
||||
for p in pdata:
|
||||
line = [0]*61
|
||||
|
||||
line[0] = 1 # HDs
|
||||
if pdata[p]['street0VPI']: line[1] = 1
|
||||
if pdata[p]['street0Aggr']: line[2] = 1
|
||||
if pdata[p]['street0_3BChance']: line[3] = 1
|
||||
if pdata[p]['street0_3BDone']: line[4] = 1
|
||||
if pdata[p]['street1Seen']: line[5] = 1
|
||||
if pdata[p]['street2Seen']: line[6] = 1
|
||||
if pdata[p]['street3Seen']: line[7] = 1
|
||||
if pdata[p]['street4Seen']: line[8] = 1
|
||||
if pdata[p]['sawShowdown']: line[9] = 1
|
||||
if pdata[p]['street1Aggr']: line[10] = 1
|
||||
if pdata[p]['street2Aggr']: line[11] = 1
|
||||
if pdata[p]['street3Aggr']: line[12] = 1
|
||||
if pdata[p]['street4Aggr']: line[13] = 1
|
||||
if pdata[p]['otherRaisedStreet1']: line[14] = 1
|
||||
if pdata[p]['otherRaisedStreet2']: line[15] = 1
|
||||
if pdata[p]['otherRaisedStreet3']: line[16] = 1
|
||||
if pdata[p]['otherRaisedStreet4']: line[17] = 1
|
||||
if pdata[p]['foldToOtherRaisedStreet1']: line[18] = 1
|
||||
if pdata[p]['foldToOtherRaisedStreet2']: line[19] = 1
|
||||
if pdata[p]['foldToOtherRaisedStreet3']: line[20] = 1
|
||||
if pdata[p]['foldToOtherRaisedStreet4']: line[21] = 1
|
||||
line[22] = pdata[p]['wonWhenSeenStreet1']
|
||||
line[23] = pdata[p]['wonAtSD']
|
||||
if pdata[p]['stealAttemptChance']: line[24] = 1
|
||||
if pdata[p]['stealAttempted']: line[25] = 1
|
||||
if pdata[p]['foldBbToStealChance']: line[26] = 1
|
||||
if pdata[p]['foldedBbToSteal']: line[27] = 1
|
||||
if pdata[p]['foldSbToStealChance']: line[28] = 1
|
||||
if pdata[p]['foldedSbToSteal']: line[29] = 1
|
||||
if pdata[p]['street1CBChance']: line[30] = 1
|
||||
if pdata[p]['street1CBDone']: line[31] = 1
|
||||
if pdata[p]['street2CBChance']: line[32] = 1
|
||||
if pdata[p]['street2CBDone']: line[33] = 1
|
||||
if pdata[p]['street3CBChance']: line[34] = 1
|
||||
if pdata[p]['street3CBDone']: line[35] = 1
|
||||
if pdata[p]['street4CBChance']: line[36] = 1
|
||||
if pdata[p]['street4CBDone']: line[37] = 1
|
||||
if pdata[p]['foldToStreet1CBChance']: line[38] = 1
|
||||
if pdata[p]['foldToStreet1CBDone']: line[39] = 1
|
||||
if pdata[p]['foldToStreet2CBChance']: line[40] = 1
|
||||
if pdata[p]['foldToStreet2CBDone']: line[41] = 1
|
||||
if pdata[p]['foldToStreet3CBChance']: line[42] = 1
|
||||
if pdata[p]['foldToStreet3CBDone']: line[43] = 1
|
||||
if pdata[p]['foldToStreet4CBChance']: line[44] = 1
|
||||
if pdata[p]['foldToStreet4CBDone']: line[45] = 1
|
||||
line[46] = pdata[p]['totalProfit']
|
||||
if pdata[p]['street1CheckCallRaiseChance']: line[47] = 1
|
||||
if pdata[p]['street1CheckCallRaiseDone']: line[48] = 1
|
||||
if pdata[p]['street2CheckCallRaiseChance']: line[49] = 1
|
||||
if pdata[p]['street2CheckCallRaiseDone']: line[50] = 1
|
||||
if pdata[p]['street3CheckCallRaiseChance']: line[51] = 1
|
||||
if pdata[p]['street3CheckCallRaiseDone']: line[52] = 1
|
||||
if pdata[p]['street4CheckCallRaiseChance']: line[53] = 1
|
||||
if pdata[p]['street4CheckCallRaiseDone']: line[54] = 1
|
||||
line[55] = gid # gametypeId
|
||||
line[56] = pids[p] # playerId
|
||||
line[57] = len(pids) # activeSeats
|
||||
line[58] = pdata[p]['position']
|
||||
line[59] = pdata[p]['tourneyTypeId']
|
||||
line[60] = styleKey # styleKey
|
||||
inserts.append(line)
|
||||
|
||||
|
||||
cursor = self.get_cursor()
|
||||
|
||||
for row in inserts:
|
||||
# Try to do the update first:
|
||||
num = cursor.execute(update_hudcache, row)
|
||||
# Test statusmessage to see if update worked, do insert if not
|
||||
# num is a cursor in sqlite
|
||||
if ((self.backend == self.PGSQL and cursor.statusmessage != "UPDATE 1")
|
||||
or (self.backend == self.MYSQL_INNODB and num == 0)
|
||||
or (self.backend == self.SQLITE and num.rowcount == 0)):
|
||||
#move the last 6 items in WHERE clause of row from the end of the array
|
||||
# to the beginning for the INSERT statement
|
||||
print "DEBUG: using INSERT: %s" % num
|
||||
row = row[-6:] + row[:-6]
|
||||
num = cursor.execute(insert_hudcache, row)
|
||||
print "DEBUG: Successfully(?: %s) updated HudCacho using INSERT" % num
|
||||
else:
|
||||
# hard-code styleKey as 'A000000' (all-time cache, no key) for now
|
||||
styleKey = 'A000000'
|
||||
|
||||
#print "storeHudCache, len(playerIds)=", len(playerIds), " len(vpip)=" \
|
||||
#, len(hudImportData['street0VPI']), " len(totprof)=", len(hudImportData['totalProfit'])
|
||||
for player in xrange(len(playerIds)):
|
||||
|
||||
# Set up a clean row
|
||||
row=[]
|
||||
row.append(0)#blank for id
|
||||
row.append(gametypeId)
|
||||
row.append(playerIds[player])
|
||||
row.append(len(playerIds))#seats
|
||||
for i in xrange(len(hudImportData)+2):
|
||||
row.append(0)
|
||||
|
||||
if base=="hold":
|
||||
row[4]=hudImportData['position'][player]
|
||||
else:
|
||||
row[4]=0
|
||||
row[5]=1 #tourneysGametypeId
|
||||
row[6]+=1 #HDs
|
||||
if hudImportData['street0VPI'][player]: row[7]+=1
|
||||
if hudImportData['street0Aggr'][player]: row[8]+=1
|
||||
if hudImportData['street0_3BChance'][player]: row[9]+=1
|
||||
if hudImportData['street0_3BDone'][player]: row[10]+=1
|
||||
if hudImportData['street1Seen'][player]: row[11]+=1
|
||||
if hudImportData['street2Seen'][player]: row[12]+=1
|
||||
if hudImportData['street3Seen'][player]: row[13]+=1
|
||||
if hudImportData['street4Seen'][player]: row[14]+=1
|
||||
if hudImportData['sawShowdown'][player]: row[15]+=1
|
||||
if hudImportData['street1Aggr'][player]: row[16]+=1
|
||||
if hudImportData['street2Aggr'][player]: row[17]+=1
|
||||
if hudImportData['street3Aggr'][player]: row[18]+=1
|
||||
if hudImportData['street4Aggr'][player]: row[19]+=1
|
||||
if hudImportData['otherRaisedStreet1'][player]: row[20]+=1
|
||||
if hudImportData['otherRaisedStreet2'][player]: row[21]+=1
|
||||
if hudImportData['otherRaisedStreet3'][player]: row[22]+=1
|
||||
if hudImportData['otherRaisedStreet4'][player]: row[23]+=1
|
||||
if hudImportData['foldToOtherRaisedStreet1'][player]: row[24]+=1
|
||||
if hudImportData['foldToOtherRaisedStreet2'][player]: row[25]+=1
|
||||
if hudImportData['foldToOtherRaisedStreet3'][player]: row[26]+=1
|
||||
if hudImportData['foldToOtherRaisedStreet4'][player]: row[27]+=1
|
||||
if hudImportData['wonWhenSeenStreet1'][player]!=0.0: row[28]+=hudImportData['wonWhenSeenStreet1'][player]
|
||||
if hudImportData['wonAtSD'][player]!=0.0: row[29]+=hudImportData['wonAtSD'][player]
|
||||
if hudImportData['stealAttemptChance'][player]: row[30]+=1
|
||||
if hudImportData['stealAttempted'][player]: row[31]+=1
|
||||
if hudImportData['foldBbToStealChance'][player]: row[32]+=1
|
||||
if hudImportData['foldedBbToSteal'][player]: row[33]+=1
|
||||
if hudImportData['foldSbToStealChance'][player]: row[34]+=1
|
||||
if hudImportData['foldedSbToSteal'][player]: row[35]+=1
|
||||
|
||||
if hudImportData['street1CBChance'][player]: row[36]+=1
|
||||
if hudImportData['street1CBDone'][player]: row[37]+=1
|
||||
if hudImportData['street2CBChance'][player]: row[38]+=1
|
||||
if hudImportData['street2CBDone'][player]: row[39]+=1
|
||||
if hudImportData['street3CBChance'][player]: row[40]+=1
|
||||
if hudImportData['street3CBDone'][player]: row[41]+=1
|
||||
if hudImportData['street4CBChance'][player]: row[42]+=1
|
||||
if hudImportData['street4CBDone'][player]: row[43]+=1
|
||||
|
||||
if hudImportData['foldToStreet1CBChance'][player]: row[44]+=1
|
||||
if hudImportData['foldToStreet1CBDone'][player]: row[45]+=1
|
||||
if hudImportData['foldToStreet2CBChance'][player]: row[46]+=1
|
||||
if hudImportData['foldToStreet2CBDone'][player]: row[47]+=1
|
||||
if hudImportData['foldToStreet3CBChance'][player]: row[48]+=1
|
||||
if hudImportData['foldToStreet3CBDone'][player]: row[49]+=1
|
||||
if hudImportData['foldToStreet4CBChance'][player]: row[50]+=1
|
||||
if hudImportData['foldToStreet4CBDone'][player]: row[51]+=1
|
||||
|
||||
#print "player=", player
|
||||
#print "len(totalProfit)=", len(hudImportData['totalProfit'])
|
||||
if hudImportData['totalProfit'][player]:
|
||||
row[52]+=hudImportData['totalProfit'][player]
|
||||
|
||||
if hudImportData['street1CheckCallRaiseChance'][player]: row[53]+=1
|
||||
if hudImportData['street1CheckCallRaiseDone'][player]: row[54]+=1
|
||||
if hudImportData['street2CheckCallRaiseChance'][player]: row[55]+=1
|
||||
if hudImportData['street2CheckCallRaiseDone'][player]: row[56]+=1
|
||||
if hudImportData['street3CheckCallRaiseChance'][player]: row[57]+=1
|
||||
if hudImportData['street3CheckCallRaiseDone'][player]: row[58]+=1
|
||||
if hudImportData['street4CheckCallRaiseChance'][player]: row[59]+=1
|
||||
if hudImportData['street4CheckCallRaiseDone'][player]: row[60]+=1
|
||||
|
||||
# Try to do the update first:
|
||||
cursor = self.get_cursor()
|
||||
num = cursor.execute("""UPDATE HudCache
|
||||
SET HDs=HDs+%s, street0VPI=street0VPI+%s, street0Aggr=street0Aggr+%s,
|
||||
street0_3BChance=street0_3BChance+%s, street0_3BDone=street0_3BDone+%s,
|
||||
street1Seen=street1Seen+%s, street2Seen=street2Seen+%s, street3Seen=street3Seen+%s,
|
||||
street4Seen=street4Seen+%s, sawShowdown=sawShowdown+%s,
|
||||
street1Aggr=street1Aggr+%s, street2Aggr=street2Aggr+%s, street3Aggr=street3Aggr+%s,
|
||||
street4Aggr=street4Aggr+%s, otherRaisedStreet1=otherRaisedStreet1+%s,
|
||||
otherRaisedStreet2=otherRaisedStreet2+%s, otherRaisedStreet3=otherRaisedStreet3+%s,
|
||||
otherRaisedStreet4=otherRaisedStreet4+%s,
|
||||
foldToOtherRaisedStreet1=foldToOtherRaisedStreet1+%s, foldToOtherRaisedStreet2=foldToOtherRaisedStreet2+%s,
|
||||
foldToOtherRaisedStreet3=foldToOtherRaisedStreet3+%s, foldToOtherRaisedStreet4=foldToOtherRaisedStreet4+%s,
|
||||
wonWhenSeenStreet1=wonWhenSeenStreet1+%s, wonAtSD=wonAtSD+%s, stealAttemptChance=stealAttemptChance+%s,
|
||||
stealAttempted=stealAttempted+%s, foldBbToStealChance=foldBbToStealChance+%s,
|
||||
foldedBbToSteal=foldedBbToSteal+%s,
|
||||
foldSbToStealChance=foldSbToStealChance+%s, foldedSbToSteal=foldedSbToSteal+%s,
|
||||
street1CBChance=street1CBChance+%s, street1CBDone=street1CBDone+%s, street2CBChance=street2CBChance+%s,
|
||||
street2CBDone=street2CBDone+%s, street3CBChance=street3CBChance+%s,
|
||||
street3CBDone=street3CBDone+%s, street4CBChance=street4CBChance+%s, street4CBDone=street4CBDone+%s,
|
||||
foldToStreet1CBChance=foldToStreet1CBChance+%s, foldToStreet1CBDone=foldToStreet1CBDone+%s,
|
||||
foldToStreet2CBChance=foldToStreet2CBChance+%s, foldToStreet2CBDone=foldToStreet2CBDone+%s,
|
||||
foldToStreet3CBChance=foldToStreet3CBChance+%s,
|
||||
foldToStreet3CBDone=foldToStreet3CBDone+%s, foldToStreet4CBChance=foldToStreet4CBChance+%s,
|
||||
foldToStreet4CBDone=foldToStreet4CBDone+%s, totalProfit=totalProfit+%s,
|
||||
street1CheckCallRaiseChance=street1CheckCallRaiseChance+%s,
|
||||
street1CheckCallRaiseDone=street1CheckCallRaiseDone+%s, street2CheckCallRaiseChance=street2CheckCallRaiseChance+%s,
|
||||
street2CheckCallRaiseDone=street2CheckCallRaiseDone+%s, street3CheckCallRaiseChance=street3CheckCallRaiseChance+%s,
|
||||
street3CheckCallRaiseDone=street3CheckCallRaiseDone+%s, street4CheckCallRaiseChance=street4CheckCallRaiseChance+%s,
|
||||
street4CheckCallRaiseDone=street4CheckCallRaiseDone+%s
|
||||
WHERE gametypeId+0=%s
|
||||
AND playerId=%s
|
||||
AND activeSeats=%s
|
||||
AND position=%s
|
||||
AND tourneyTypeId+0=%s
|
||||
AND styleKey=%s
|
||||
""".replace('%s', self.sql.query['placeholder'])
|
||||
,(row[6], row[7], row[8], row[9], row[10],
|
||||
row[11], row[12], row[13], row[14], row[15],
|
||||
row[16], row[17], row[18], row[19], row[20],
|
||||
row[21], row[22], row[23], row[24], row[25],
|
||||
row[26], row[27], row[28], row[29], row[30],
|
||||
row[31], row[32], row[33], row[34], row[35],
|
||||
row[36], row[37], row[38], row[39], row[40],
|
||||
row[41], row[42], row[43], row[44], row[45],
|
||||
row[46], row[47], row[48], row[49], row[50],
|
||||
row[51], row[52], row[53], row[54], row[55],
|
||||
row[56], row[57], row[58], row[59], row[60],
|
||||
row[1], row[2], row[3], str(row[4]), row[5], styleKey))
|
||||
# Test statusmessage to see if update worked, do insert if not
|
||||
#print "storehud2, upd num =", num.rowcount
|
||||
# num is a cursor in sqlite
|
||||
if ( (backend == self.PGSQL and cursor.statusmessage != "UPDATE 1")
|
||||
or (backend == self.MYSQL_INNODB and num == 0)
|
||||
or (backend == self.SQLITE and num.rowcount == 0)
|
||||
):
|
||||
#print "playerid before insert:",row[2]," num = ", num
|
||||
num = cursor.execute("""INSERT INTO HudCache
|
||||
(gametypeId, playerId, activeSeats, position, tourneyTypeId, styleKey,
|
||||
HDs, street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
|
||||
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
|
||||
street1Aggr, street2Aggr, street3Aggr, street4Aggr, otherRaisedStreet1,
|
||||
otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4, foldToOtherRaisedStreet1, foldToOtherRaisedStreet2,
|
||||
foldToOtherRaisedStreet3, foldToOtherRaisedStreet4, wonWhenSeenStreet1, wonAtSD, stealAttemptChance,
|
||||
stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal,
|
||||
street1CBChance, street1CBDone, street2CBChance, street2CBDone, street3CBChance,
|
||||
street3CBDone, street4CBChance, street4CBDone, foldToStreet1CBChance, foldToStreet1CBDone,
|
||||
foldToStreet2CBChance, foldToStreet2CBDone, foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance,
|
||||
foldToStreet4CBDone, totalProfit, street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance,
|
||||
street2CheckCallRaiseDone, street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone)
|
||||
VALUES (%s, %s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s)""".replace('%s', self.sql.query['placeholder'])
|
||||
, (row[1], row[2], row[3], row[4], row[5], styleKey, row[6], row[7], row[8], row[9], row[10]
|
||||
,row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20]
|
||||
,row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30]
|
||||
,row[31], row[32], row[33], row[34], row[35], row[36], row[37], row[38], row[39], row[40]
|
||||
,row[41], row[42], row[43], row[44], row[45], row[46], row[47], row[48], row[49], row[50]
|
||||
,row[51], row[52], row[53], row[54], row[55], row[56], row[57], row[58], row[59], row[60]) )
|
||||
#print "hopefully inserted hud data line: ", cursor.rowcount
|
||||
# message seems to be "INSERT 0 1"
|
||||
else:
|
||||
#print "updated(2) hud data line"
|
||||
pass
|
||||
# else:
|
||||
# print "todo: implement storeHudCache for stud base"
|
||||
print "DEBUG: Successfully updated HudCacho using UPDATE"
|
||||
pass
|
||||
|
||||
def isDuplicate(self, gametypeID, siteHandNo):
|
||||
dup = False
|
||||
|
|
|
@ -201,6 +201,7 @@ class DerivedStats():
|
|||
# 2 Hijack
|
||||
|
||||
def assembleHudCache(self, hand):
|
||||
# No real work to be done - HandsPlayers data already contains the correct info
|
||||
pass
|
||||
|
||||
def vpip(self, hand):
|
||||
|
@ -443,4 +444,5 @@ class DerivedStats():
|
|||
betOrRaise = True
|
||||
else:
|
||||
break
|
||||
return betOrRaise
|
||||
|
||||
|
|
|
@ -232,6 +232,9 @@ db: a connected fpdb_db object"""
|
|||
#Raise Duplicate exception?
|
||||
pass
|
||||
|
||||
def updateHudCache(self, db):
|
||||
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.starttime, self.stats.getHandsPlayers())
|
||||
|
||||
def select(self, handId):
|
||||
""" Function to create Hand object from database """
|
||||
|
||||
|
|
141
pyfpdb/SQL.py
141
pyfpdb/SQL.py
|
@ -3088,6 +3088,147 @@ class Sql:
|
|||
,'d' || substr(strftime('%Y%m%d', h.handStart),3,7)
|
||||
"""
|
||||
|
||||
self.query['insert_hudcache'] = """
|
||||
INSERT INTO HudCache (
|
||||
gametypeId,
|
||||
playerId,
|
||||
activeSeats,
|
||||
position,
|
||||
tourneyTypeId,
|
||||
styleKey,
|
||||
HDs,
|
||||
street0VPI,
|
||||
street0Aggr,
|
||||
street0_3BChance,
|
||||
street0_3BDone,
|
||||
street1Seen,
|
||||
street2Seen,
|
||||
street3Seen,
|
||||
street4Seen,
|
||||
sawShowdown,
|
||||
street1Aggr,
|
||||
street2Aggr,
|
||||
street3Aggr,
|
||||
street4Aggr,
|
||||
otherRaisedStreet1,
|
||||
otherRaisedStreet2,
|
||||
otherRaisedStreet3,
|
||||
otherRaisedStreet4,
|
||||
foldToOtherRaisedStreet1,
|
||||
foldToOtherRaisedStreet2,
|
||||
foldToOtherRaisedStreet3,
|
||||
foldToOtherRaisedStreet4,
|
||||
wonWhenSeenStreet1,
|
||||
wonAtSD,
|
||||
stealAttemptChance,
|
||||
stealAttempted,
|
||||
foldBbToStealChance,
|
||||
foldedBbToSteal,
|
||||
foldSbToStealChance,
|
||||
foldedSbToSteal,
|
||||
street1CBChance,
|
||||
street1CBDone,
|
||||
street2CBChance,
|
||||
street2CBDone,
|
||||
street3CBChance,
|
||||
street3CBDone,
|
||||
street4CBChance,
|
||||
street4CBDone,
|
||||
foldToStreet1CBChance,
|
||||
foldToStreet1CBDone,
|
||||
foldToStreet2CBChance,
|
||||
foldToStreet2CBDone,
|
||||
foldToStreet3CBChance,
|
||||
foldToStreet3CBDone,
|
||||
foldToStreet4CBChance,
|
||||
foldToStreet4CBDone,
|
||||
totalProfit,
|
||||
street1CheckCallRaiseChance,
|
||||
street1CheckCallRaiseDone,
|
||||
street2CheckCallRaiseChance,
|
||||
street2CheckCallRaiseDone,
|
||||
street3CheckCallRaiseChance,
|
||||
street3CheckCallRaiseDone,
|
||||
street4CheckCallRaiseChance,
|
||||
street4CheckCallRaiseDone)
|
||||
VALUES (%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s, %s,
|
||||
%s)"""
|
||||
|
||||
self.query['update_hudcache'] = """
|
||||
UPDATE HudCache SET
|
||||
HDs=HDs+%s,
|
||||
street0VPI=street0VPI+%s,
|
||||
street0Aggr=street0Aggr+%s,
|
||||
street0_3BChance=street0_3BChance+%s,
|
||||
street0_3BDone=street0_3BDone+%s,
|
||||
street1Seen=street1Seen+%s,
|
||||
street2Seen=street2Seen+%s,
|
||||
street3Seen=street3Seen+%s,
|
||||
street4Seen=street4Seen+%s,
|
||||
sawShowdown=sawShowdown+%s,
|
||||
street1Aggr=street1Aggr+%s,
|
||||
street2Aggr=street2Aggr+%s,
|
||||
street3Aggr=street3Aggr+%s,
|
||||
street4Aggr=street4Aggr+%s,
|
||||
otherRaisedStreet1=otherRaisedStreet1+%s,
|
||||
otherRaisedStreet2=otherRaisedStreet2+%s,
|
||||
otherRaisedStreet3=otherRaisedStreet3+%s,
|
||||
otherRaisedStreet4=otherRaisedStreet4+%s,
|
||||
foldToOtherRaisedStreet1=foldToOtherRaisedStreet1+%s,
|
||||
foldToOtherRaisedStreet2=foldToOtherRaisedStreet2+%s,
|
||||
foldToOtherRaisedStreet3=foldToOtherRaisedStreet3+%s,
|
||||
foldToOtherRaisedStreet4=foldToOtherRaisedStreet4+%s,
|
||||
wonWhenSeenStreet1=wonWhenSeenStreet1+%s,
|
||||
wonAtSD=wonAtSD+%s,
|
||||
stealAttemptChance=stealAttemptChance+%s,
|
||||
stealAttempted=stealAttempted+%s,
|
||||
foldBbToStealChance=foldBbToStealChance+%s,
|
||||
foldedBbToSteal=foldedBbToSteal+%s,
|
||||
foldSbToStealChance=foldSbToStealChance+%s,
|
||||
foldedSbToSteal=foldedSbToSteal+%s,
|
||||
street1CBChance=street1CBChance+%s,
|
||||
street1CBDone=street1CBDone+%s,
|
||||
street2CBChance=street2CBChance+%s,
|
||||
street2CBDone=street2CBDone+%s,
|
||||
street3CBChance=street3CBChance+%s,
|
||||
street3CBDone=street3CBDone+%s,
|
||||
street4CBChance=street4CBChance+%s,
|
||||
street4CBDone=street4CBDone+%s,
|
||||
foldToStreet1CBChance=foldToStreet1CBChance+%s,
|
||||
foldToStreet1CBDone=foldToStreet1CBDone+%s,
|
||||
foldToStreet2CBChance=foldToStreet2CBChance+%s,
|
||||
foldToStreet2CBDone=foldToStreet2CBDone+%s,
|
||||
foldToStreet3CBChance=foldToStreet3CBChance+%s,
|
||||
foldToStreet3CBDone=foldToStreet3CBDone+%s,
|
||||
foldToStreet4CBChance=foldToStreet4CBChance+%s,
|
||||
foldToStreet4CBDone=foldToStreet4CBDone+%s,
|
||||
totalProfit=totalProfit+%s,
|
||||
street1CheckCallRaiseChance=street1CheckCallRaiseChance+%s,
|
||||
street1CheckCallRaiseDone=street1CheckCallRaiseDone+%s,
|
||||
street2CheckCallRaiseChance=street2CheckCallRaiseChance+%s,
|
||||
street2CheckCallRaiseDone=street2CheckCallRaiseDone+%s,
|
||||
street3CheckCallRaiseChance=street3CheckCallRaiseChance+%s,
|
||||
street3CheckCallRaiseDone=street3CheckCallRaiseDone+%s,
|
||||
street4CheckCallRaiseChance=street4CheckCallRaiseChance+%s,
|
||||
street4CheckCallRaiseDone=street4CheckCallRaiseDone+%s
|
||||
WHERE gametypeId+0=%s
|
||||
AND playerId=%s
|
||||
AND activeSeats=%s
|
||||
AND position=%s
|
||||
AND tourneyTypeId+0=%s
|
||||
AND styleKey=%s"""
|
||||
|
||||
self.query['get_hero_hudcache_start'] = """select min(hc.styleKey)
|
||||
from HudCache hc
|
||||
where hc.playerId in <playerid_list>
|
||||
|
|
|
@ -432,9 +432,8 @@ class Importer:
|
|||
idx = self.pos_in_file[file]
|
||||
else:
|
||||
self.pos_in_file[file] = 0
|
||||
hhc = obj(in_path = file, out_path = out_path, index = idx, starsArchive = self.settings['starsArchive']) # Index into file 0 until changeover
|
||||
hhc = obj(in_path = file, out_path = out_path, index = idx, starsArchive = self.settings['starsArchive'])
|
||||
if hhc.getStatus() and self.NEWIMPORT == True:
|
||||
#This code doesn't do anything yet
|
||||
handlist = hhc.getProcessedHands()
|
||||
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
||||
to_hud = []
|
||||
|
@ -449,8 +448,10 @@ class Importer:
|
|||
else:
|
||||
log.error("Hand processed but empty")
|
||||
self.database.commit()
|
||||
# Call hudcache update if not in bulk import mode
|
||||
# FIXME: Need to test for bulk import that isn't rebuilding the cache
|
||||
if self.callHud:
|
||||
self.database.rebuild_hudcache()
|
||||
hand.updateHudCache(self.database)
|
||||
|
||||
#pipe the Hands.id out to the HUD
|
||||
for hid in to_hud:
|
||||
|
|
Loading…
Reference in New Issue
Block a user