[NEWIMPORT] Start of HandsPlayers insert
This commit is contained in:
parent
f0f2bcda14
commit
2350474d38
|
@ -1421,19 +1421,29 @@ class Database:
|
||||||
p['street4Pot'],
|
p['street4Pot'],
|
||||||
p['showdownPot']
|
p['showdownPot']
|
||||||
))
|
))
|
||||||
#return getLastInsertId(backend, conn, cursor)
|
return self.get_last_insert_id(self.cursor)
|
||||||
# def storeHand
|
# def storeHand
|
||||||
|
|
||||||
def storeHandsPlayers(self, hid, pid, p):
|
def storeHandsPlayers(self, hid, pids, pdata):
|
||||||
|
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
|
||||||
|
inserts = []
|
||||||
|
for p in pdata:
|
||||||
|
inserts.append( (hid,
|
||||||
|
pids[p],
|
||||||
|
pdata[p]['startCash'],
|
||||||
|
pdata[p]['seatNo']
|
||||||
|
) )
|
||||||
|
|
||||||
q = """INSERT INTO HandsPlayers (
|
q = """INSERT INTO HandsPlayers (
|
||||||
handId,
|
handId,
|
||||||
playerId
|
playerId,
|
||||||
|
startCash,
|
||||||
|
seatNo
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
%s, %s
|
%s, %s, %s, %s
|
||||||
)"""
|
)"""
|
||||||
|
|
||||||
# startCash,
|
|
||||||
# position,
|
# position,
|
||||||
# tourneyTypeId,
|
# tourneyTypeId,
|
||||||
# card1,
|
# card1,
|
||||||
|
@ -1443,7 +1453,6 @@ class Database:
|
||||||
# startCards,
|
# startCards,
|
||||||
# winnings,
|
# winnings,
|
||||||
# rake,
|
# rake,
|
||||||
# seatNo,
|
|
||||||
# totalProfit,
|
# totalProfit,
|
||||||
# street0VPI,
|
# street0VPI,
|
||||||
# street0Aggr,
|
# street0Aggr,
|
||||||
|
@ -1511,85 +1520,8 @@ class Database:
|
||||||
|
|
||||||
q = q.replace('%s', self.sql.query['placeholder'])
|
q = q.replace('%s', self.sql.query['placeholder'])
|
||||||
|
|
||||||
self.cursor.execute(q, (
|
#print "DEBUG: inserts: %s" %inserts
|
||||||
hid,
|
self.cursor.executemany(q, inserts)
|
||||||
pid
|
|
||||||
))
|
|
||||||
# startCash,
|
|
||||||
# position,
|
|
||||||
# tourneyTypeId,
|
|
||||||
# card1,
|
|
||||||
# card2,
|
|
||||||
# card3,
|
|
||||||
# card4,
|
|
||||||
# startCards,
|
|
||||||
# winnings,
|
|
||||||
# rake,
|
|
||||||
# seatNo,
|
|
||||||
# totalProfit,
|
|
||||||
# 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,
|
|
||||||
# street1CheckCallRaiseChance,
|
|
||||||
# street1CheckCallRaiseDone,
|
|
||||||
# street2CheckCallRaiseChance,
|
|
||||||
# street2CheckCallRaiseDone,
|
|
||||||
# street3CheckCallRaiseChance,
|
|
||||||
# street3CheckCallRaiseDone,
|
|
||||||
# street4CheckCallRaiseChance,
|
|
||||||
# street4CheckCallRaiseDone,
|
|
||||||
# street0Calls,
|
|
||||||
# street1Calls,
|
|
||||||
# street2Calls,
|
|
||||||
# street3Calls,
|
|
||||||
# street4Calls,
|
|
||||||
# street0Bets,
|
|
||||||
# street1Bets,
|
|
||||||
# street2Bets,
|
|
||||||
# street3Bets,
|
|
||||||
# street4Bets
|
|
||||||
|
|
||||||
def storeHudCacheNew(self, gid, pid, hc):
|
def storeHudCacheNew(self, gid, pid, hc):
|
||||||
q = """INSERT INTO HudCache (
|
q = """INSERT INTO HudCache (
|
||||||
|
|
|
@ -39,6 +39,9 @@ class DerivedStats():
|
||||||
def getHands(self):
|
def getHands(self):
|
||||||
return self.hands
|
return self.hands
|
||||||
|
|
||||||
|
def getHandsPlayers(self):
|
||||||
|
return self.handsplayers
|
||||||
|
|
||||||
def assembleHands(self, hand):
|
def assembleHands(self, hand):
|
||||||
self.hands['tableName'] = hand.tablename
|
self.hands['tableName'] = hand.tablename
|
||||||
self.hands['siteHandNo'] = hand.handid
|
self.hands['siteHandNo'] = hand.handid
|
||||||
|
@ -77,10 +80,18 @@ class DerivedStats():
|
||||||
# commentTs DATETIME
|
# commentTs DATETIME
|
||||||
|
|
||||||
def assembleHandsPlayers(self, hand):
|
def assembleHandsPlayers(self, hand):
|
||||||
self.vpip(self.hand)
|
#self.vpip(self.hand)
|
||||||
|
|
||||||
|
#hand.players = [[seat, name, chips],[seat, name, chips]]
|
||||||
|
for player in hand.players:
|
||||||
|
self.handsplayers[player[1]] = {}
|
||||||
|
self.handsplayers[player[1]]['seatNo'] = player[0]
|
||||||
|
self.handsplayers[player[1]]['startCash'] = player[2]
|
||||||
|
|
||||||
for i, street in enumerate(hand.actionStreets[1:]):
|
for i, street in enumerate(hand.actionStreets[1:]):
|
||||||
self.aggr(self.hand, i)
|
self.aggr(self.hand, i)
|
||||||
|
|
||||||
|
|
||||||
def assembleHudCache(self, hand):
|
def assembleHudCache(self, hand):
|
||||||
# # def generateHudCacheData(player_ids, base, category, action_types, allIns, actionTypeByNo
|
# # def generateHudCacheData(player_ids, base, category, action_types, allIns, actionTypeByNo
|
||||||
# # ,winnings, totalWinnings, positions, actionTypes, actionAmounts, antes):
|
# # ,winnings, totalWinnings, positions, actionTypes, actionAmounts, antes):
|
||||||
|
|
|
@ -206,13 +206,14 @@ db: a connected fpdb_db object"""
|
||||||
gtid = db.getGameTypeId(self.siteId, self.gametype)
|
gtid = db.getGameTypeId(self.siteId, self.gametype)
|
||||||
|
|
||||||
self.stats.assembleHands(self)
|
self.stats.assembleHands(self)
|
||||||
|
self.stats.assembleHandsPlayers(self)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# End prep functions
|
# End prep functions
|
||||||
#####
|
#####
|
||||||
|
|
||||||
# HudCache data to come from DerivedStats class
|
|
||||||
# HandsActions - all actions for all players for all streets - self.actions
|
# 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
|
# Hands - Summary information of hand indexed by handId - gameinfo
|
||||||
hh = self.stats.getHands()
|
hh = self.stats.getHands()
|
||||||
|
@ -223,6 +224,7 @@ db: a connected fpdb_db object"""
|
||||||
#print hh
|
#print hh
|
||||||
handid = db.storeHand(hh)
|
handid = db.storeHand(hh)
|
||||||
# HandsPlayers - ? ... Do we fix winnings?
|
# HandsPlayers - ? ... Do we fix winnings?
|
||||||
|
db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers())
|
||||||
# Tourneys ?
|
# Tourneys ?
|
||||||
# TourneysPlayers
|
# TourneysPlayers
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user