[NEWIMPORT] Start of HandsPlayers insert

This commit is contained in:
Worros 2009-10-14 20:20:17 +08:00
parent f0f2bcda14
commit 2350474d38
3 changed files with 32 additions and 87 deletions

View File

@ -1421,19 +1421,29 @@ class Database:
p['street4Pot'],
p['showdownPot']
))
#return getLastInsertId(backend, conn, cursor)
return self.get_last_insert_id(self.cursor)
# 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 (
handId,
playerId
playerId,
startCash,
seatNo
)
VALUES (
%s, %s
%s, %s, %s, %s
)"""
# startCash,
# position,
# tourneyTypeId,
# card1,
@ -1443,7 +1453,6 @@ class Database:
# startCards,
# winnings,
# rake,
# seatNo,
# totalProfit,
# street0VPI,
# street0Aggr,
@ -1511,85 +1520,8 @@ class Database:
q = q.replace('%s', self.sql.query['placeholder'])
self.cursor.execute(q, (
hid,
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
#print "DEBUG: inserts: %s" %inserts
self.cursor.executemany(q, inserts)
def storeHudCacheNew(self, gid, pid, hc):
q = """INSERT INTO HudCache (

View File

@ -39,6 +39,9 @@ class DerivedStats():
def getHands(self):
return self.hands
def getHandsPlayers(self):
return self.handsplayers
def assembleHands(self, hand):
self.hands['tableName'] = hand.tablename
self.hands['siteHandNo'] = hand.handid
@ -77,10 +80,18 @@ class DerivedStats():
# commentTs DATETIME
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:]):
self.aggr(self.hand, i)
def assembleHudCache(self, hand):
# # def generateHudCacheData(player_ids, base, category, action_types, allIns, actionTypeByNo
# # ,winnings, totalWinnings, positions, actionTypes, actionAmounts, antes):

View File

@ -206,13 +206,14 @@ db: a connected fpdb_db object"""
gtid = db.getGameTypeId(self.siteId, self.gametype)
self.stats.assembleHands(self)
self.stats.assembleHandsPlayers(self)
#####
# End prep functions
#####
# HudCache data to come from DerivedStats class
# 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()
@ -223,6 +224,7 @@ db: a connected fpdb_db object"""
#print hh
handid = db.storeHand(hh)
# HandsPlayers - ? ... Do we fix winnings?
db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers())
# Tourneys ?
# TourneysPlayers