Add playersVpi to NEWIMPORT code
Untested at the moment, moved the code from Hand.py into DerivedStats.
This commit is contained in:
parent
94af5b1ea8
commit
fdef5b12d9
|
@ -1382,6 +1382,7 @@ class Database:
|
||||||
importtime,
|
importtime,
|
||||||
seats,
|
seats,
|
||||||
maxseats,
|
maxseats,
|
||||||
|
playersVpi,
|
||||||
boardcard1,
|
boardcard1,
|
||||||
boardcard2,
|
boardcard2,
|
||||||
boardcard3,
|
boardcard3,
|
||||||
|
@ -1395,9 +1396,8 @@ class Database:
|
||||||
)
|
)
|
||||||
VALUES
|
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)"""
|
||||||
#--- texture,
|
#--- texture,
|
||||||
#-- playersVpi,
|
|
||||||
#-- playersAtStreet1,
|
#-- playersAtStreet1,
|
||||||
#-- playersAtStreet2,
|
#-- playersAtStreet2,
|
||||||
#-- playersAtStreet3,
|
#-- playersAtStreet3,
|
||||||
|
|
|
@ -106,6 +106,9 @@ class DerivedStats():
|
||||||
print "hands =", self.hands
|
print "hands =", self.hands
|
||||||
print "handsplayers =", self.handsplayers
|
print "handsplayers =", self.handsplayers
|
||||||
|
|
||||||
|
def getHands(self):
|
||||||
|
return self.hands
|
||||||
|
|
||||||
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
|
||||||
|
@ -114,17 +117,53 @@ class DerivedStats():
|
||||||
self.hands['importTime'] = None
|
self.hands['importTime'] = None
|
||||||
self.hands['seats'] = self.countPlayers(hand)
|
self.hands['seats'] = self.countPlayers(hand)
|
||||||
self.hands['maxSeats'] = hand.maxseats
|
self.hands['maxSeats'] = hand.maxseats
|
||||||
self.hands['boardcard1'] = None
|
|
||||||
self.hands['boardcard2'] = None
|
|
||||||
self.hands['boardcard3'] = None
|
|
||||||
self.hands['boardcard4'] = None
|
|
||||||
self.hands['boardcard5'] = None
|
|
||||||
|
|
||||||
boardCard = 1
|
# This (i think...) is correct for both stud and flop games, as hand.board['street'] disappears, and
|
||||||
for street in hand.communityStreets:
|
# those values remain default in stud.
|
||||||
for card in hand.board[street]:
|
boardcards = hand.board['FLOP'] + hand.board['TURN'] + hand.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
||||||
self.hands['boardcard%s' % str(boardCard)] = Card.encodeCard(card)
|
cards = [Card.encodeCard(c) for c in boardcards[0:5]]
|
||||||
boardCard += 1
|
self.hands['boardcard1'] = cards[0]
|
||||||
|
self.hands['boardcard2'] = cards[1]
|
||||||
|
self.hands['boardcard3'] = cards[2]
|
||||||
|
self.hands['boardcard4'] = cards[3]
|
||||||
|
self.hands['boardcard5'] = cards[4]
|
||||||
|
|
||||||
|
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % hand.getStreetTotals()
|
||||||
|
#FIXME: Pot size still in decimal, needs to be converted to cents
|
||||||
|
(self.hands['street1Pot'],
|
||||||
|
self.hands['street2Pot'],
|
||||||
|
self.hands['street3Pot'],
|
||||||
|
self.hands['street4Pot'],
|
||||||
|
self.hands['showdownPot']) = hand.getStreetTotals()
|
||||||
|
|
||||||
|
|
||||||
|
self.vpip(hand) # Gives playersVpi (num of players vpip)
|
||||||
|
# texture smallint,
|
||||||
|
# playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
|
||||||
|
# Needs to be recorded
|
||||||
|
# playersAtStreet2 SMALLINT NOT NULL,
|
||||||
|
# Needs to be recorded
|
||||||
|
# playersAtStreet3 SMALLINT NOT NULL,
|
||||||
|
# Needs to be recorded
|
||||||
|
# playersAtStreet4 SMALLINT NOT NULL,
|
||||||
|
# Needs to be recorded
|
||||||
|
# playersAtShowdown SMALLINT NOT NULL,
|
||||||
|
# Needs to be recorded
|
||||||
|
# street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
|
||||||
|
# Needs to be recorded
|
||||||
|
# street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
|
||||||
|
# Needs to be recorded
|
||||||
|
# street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
|
||||||
|
# Needs to be recorded
|
||||||
|
# street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
|
||||||
|
# Needs to be recorded
|
||||||
|
# street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
|
||||||
|
# Needs to be recorded
|
||||||
|
|
||||||
|
# comment TEXT,
|
||||||
|
# commentTs DATETIME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def assembleHandsPlayers(self, hand):
|
def assembleHandsPlayers(self, hand):
|
||||||
self.vpip(self.hand)
|
self.vpip(self.hand)
|
||||||
|
|
|
@ -194,64 +194,32 @@ dealt whether they were seen in a 'dealt to' line
|
||||||
""" Function to insert Hand into database
|
""" Function to insert Hand into database
|
||||||
Should not commit, and do minimal selects. Callers may want to cache commits
|
Should not commit, and do minimal selects. Callers may want to cache commits
|
||||||
db: a connected fpdb_db object"""
|
db: a connected fpdb_db object"""
|
||||||
# TODO:
|
|
||||||
|
#####
|
||||||
|
# Players, Gametypes, TourneyTypes are all shared functions that are needed for additional tables
|
||||||
|
# These functions are intended for prep insert eventually
|
||||||
|
#####
|
||||||
# Players - base playerid and siteid tuple
|
# Players - base playerid and siteid tuple
|
||||||
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
||||||
|
|
||||||
#Gametypes
|
#Gametypes
|
||||||
gtid = db.getGameTypeId(self.siteId, self.gametype)
|
gtid = db.getGameTypeId(self.siteId, self.gametype)
|
||||||
|
|
||||||
|
self.stats.assembleHands(self)
|
||||||
|
|
||||||
|
#####
|
||||||
|
# End prep functions
|
||||||
|
#####
|
||||||
|
|
||||||
# HudCache data to come from DerivedStats class
|
# 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
|
||||||
|
|
||||||
# Hands - Summary information of hand indexed by handId - gameinfo
|
# Hands - Summary information of hand indexed by handId - gameinfo
|
||||||
#This should be moved to prepInsert
|
hh = self.stats.getHands()
|
||||||
hh = {}
|
|
||||||
hh['siteHandNo'] = self.handid
|
|
||||||
hh['handStart'] = self.starttime
|
|
||||||
hh['gameTypeId'] = gtid
|
hh['gameTypeId'] = gtid
|
||||||
# seats TINYINT NOT NULL,
|
# seats TINYINT NOT NULL,
|
||||||
hh['tableName'] = self.tablename
|
|
||||||
hh['maxSeats'] = self.maxseats
|
|
||||||
hh['seats'] = len(sqlids)
|
hh['seats'] = len(sqlids)
|
||||||
# Flop turn and river may all be empty - add (likely) too many elements and trim with range
|
|
||||||
boardcards = self.board['FLOP'] + self.board['TURN'] + self.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
|
||||||
cards = [Card.encodeCard(c) for c in boardcards[0:5]]
|
|
||||||
hh['boardcard1'] = cards[0]
|
|
||||||
hh['boardcard2'] = cards[1]
|
|
||||||
hh['boardcard3'] = cards[2]
|
|
||||||
hh['boardcard4'] = cards[3]
|
|
||||||
hh['boardcard5'] = cards[4]
|
|
||||||
|
|
||||||
# texture smallint,
|
|
||||||
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet2 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet3 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet4 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtShowdown SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
|
|
||||||
# Needs to be recorded
|
|
||||||
|
|
||||||
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % self.getStreetTotals()
|
|
||||||
#FIXME: Pot size still in decimal, needs to be converted to cents
|
|
||||||
(hh['street1Pot'], hh['street2Pot'], hh['street3Pot'], hh['street4Pot'], hh['showdownPot']) = self.getStreetTotals()
|
|
||||||
|
|
||||||
# comment TEXT,
|
|
||||||
# commentTs DATETIME
|
|
||||||
#print hh
|
#print hh
|
||||||
handid = db.storeHand(hh)
|
handid = db.storeHand(hh)
|
||||||
# HandsPlayers - ? ... Do we fix winnings?
|
# HandsPlayers - ? ... Do we fix winnings?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user