Start of storeHand from HHC code
Currently cant actually insert as we need the fk gametypeid
This commit is contained in:
parent
679393e78d
commit
5550166f37
|
@ -1043,7 +1043,7 @@ 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'])
|
||||||
|
|
||||||
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))
|
||||||
|
|
||||||
|
@ -1121,70 +1121,70 @@ class Database:
|
||||||
|
|
||||||
def storeHand(self, p):
|
def storeHand(self, p):
|
||||||
#stores into table hands:
|
#stores into table hands:
|
||||||
self.cursor.execute ("""INSERT INTO Hands (
|
q = """INSERT INTO Hands (
|
||||||
tablename,
|
tablename,
|
||||||
sitehandno,
|
|
||||||
gametypeid,
|
gametypeid,
|
||||||
|
sitehandno,
|
||||||
handstart,
|
handstart,
|
||||||
importtime,
|
importtime,
|
||||||
seats,
|
|
||||||
maxseats,
|
maxseats,
|
||||||
boardcard1,
|
boardcard1,
|
||||||
boardcard2,
|
boardcard2,
|
||||||
boardcard3,
|
boardcard3,
|
||||||
boardcard4,
|
boardcard4,
|
||||||
boardcard5,
|
boardcard5
|
||||||
-- texture,
|
|
||||||
playersVpi,
|
|
||||||
playersAtStreet1,
|
|
||||||
playersAtStreet2,
|
|
||||||
playersAtStreet3,
|
|
||||||
playersAtStreet4,
|
|
||||||
playersAtShowdown,
|
|
||||||
street0Raises,
|
|
||||||
street1Raises,
|
|
||||||
street2Raises,
|
|
||||||
street3Raises,
|
|
||||||
street4Raises,
|
|
||||||
-- street1Pot,
|
|
||||||
-- street2Pot,
|
|
||||||
-- street3Pot,
|
|
||||||
-- street4Pot,
|
|
||||||
-- showdownPot
|
|
||||||
)
|
)
|
||||||
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)""",
|
#--- texture,
|
||||||
(
|
#-- playersVpi,
|
||||||
p['tablename'],
|
#-- playersAtStreet1,
|
||||||
p['sitehandno'],
|
#-- playersAtStreet2,
|
||||||
|
#-- playersAtStreet3,
|
||||||
|
#-- playersAtStreet4,
|
||||||
|
#-- playersAtShowdown,
|
||||||
|
#-- street0Raises,
|
||||||
|
#-- street1Raises,
|
||||||
|
#-- street2Raises,
|
||||||
|
#-- street3Raises,
|
||||||
|
#-- street4Raises,
|
||||||
|
#-- street1Pot,
|
||||||
|
#-- street2Pot,
|
||||||
|
#-- street3Pot,
|
||||||
|
#-- street4Pot,
|
||||||
|
#-- showdownPot
|
||||||
|
#-- seats,
|
||||||
|
|
||||||
|
q = q.replace('%s', self.sql.query['placeholder'])
|
||||||
|
self.cursor.execute(q, (
|
||||||
|
p['tableName'],
|
||||||
|
p['siteHandNo'],
|
||||||
p['gametypeid'],
|
p['gametypeid'],
|
||||||
p['handStart'],
|
p['handStart'],
|
||||||
datetime.datetime.today(),
|
datetime.today(), #importtime
|
||||||
len(p['names']),
|
# len(p['names']), #seats
|
||||||
p['maxSeats'],
|
p['maxSeats'],
|
||||||
p['boardcard1'],
|
p['boardcard1'],
|
||||||
p['boardcard2'],
|
p['boardcard2'],
|
||||||
p['boardcard3'],
|
p['boardcard3'],
|
||||||
p['boardcard4'],
|
p['boardcard4'],
|
||||||
p['boardcard5'],
|
p['boardcard5'])
|
||||||
hudCache['playersVpi'],
|
# hudCache['playersVpi'],
|
||||||
hudCache['playersAtStreet1'],
|
# hudCache['playersAtStreet1'],
|
||||||
hudCache['playersAtStreet2'],
|
# hudCache['playersAtStreet2'],
|
||||||
hudCache['playersAtStreet3'],
|
# hudCache['playersAtStreet3'],
|
||||||
hudCache['playersAtStreet4'],
|
# hudCache['playersAtStreet4'],
|
||||||
hudCache['playersAtShowdown'],
|
# hudCache['playersAtShowdown'],
|
||||||
hudCache['street0Raises'],
|
# hudCache['street0Raises'],
|
||||||
hudCache['street1Raises'],
|
# hudCache['street1Raises'],
|
||||||
hudCache['street2Raises'],
|
# hudCache['street2Raises'],
|
||||||
hudCache['street3Raises'],
|
# hudCache['street3Raises'],
|
||||||
hudCache['street4Raises'],
|
# hudCache['street4Raises'],
|
||||||
hudCache['street1Pot'],
|
# hudCache['street1Pot'],
|
||||||
hudCache['street2Pot'],
|
# hudCache['street2Pot'],
|
||||||
hudCache['street3Pot'],
|
# hudCache['street3Pot'],
|
||||||
hudCache['street4Pot'],
|
# hudCache['street4Pot'],
|
||||||
hudCache['showdownPot']
|
# hudCache['showdownPot']
|
||||||
)
|
|
||||||
)
|
)
|
||||||
#return getLastInsertId(backend, conn, cursor)
|
#return getLastInsertId(backend, conn, cursor)
|
||||||
# def storeHand
|
# def storeHand
|
||||||
|
|
|
@ -187,29 +187,28 @@ db: a connected fpdb_db object"""
|
||||||
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
||||||
# 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
|
||||||
# BoardCards - Skip - no longer necessary
|
|
||||||
# Hands - Summary information of hand indexed by handId - gameinfo
|
# Hands - Summary information of hand indexed by handId - gameinfo
|
||||||
#hh['siteHandNo'] = self.handid
|
#This should be moved to prepInsert
|
||||||
# gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
hh = {}
|
||||||
#
|
hh['siteHandNo'] = self.handid
|
||||||
#hh['handStart'] = self.starttime
|
hh['handStart'] = self.starttime
|
||||||
# seats TINYINT NOT NULL,
|
# seats TINYINT NOT NULL,
|
||||||
#
|
hh['tableName'] = self.tablename
|
||||||
#hh['tableName'] = self.tablenam
|
hh['maxSeats'] = self.maxseats
|
||||||
#hh['maxSeats'] = self.maxseats
|
|
||||||
# boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
# boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||||
# boardcard2 smallint,
|
# boardcard2 smallint,
|
||||||
# boardcard3 smallint,
|
# boardcard3 smallint,
|
||||||
# boardcard4 smallint,
|
# boardcard4 smallint,
|
||||||
# boardcard5 smallint,
|
# boardcard5 smallint,
|
||||||
# Flop turn and river may all be empty - add (likely) too many elements and trim with range
|
# Flop turn and river may all be empty - add (likely) too many elements and trim with range
|
||||||
# boardcards = board['FLOP'] + board['TURN'] + board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
boardcards = self.board['FLOP'] + self.board['TURN'] + self.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
||||||
# cards = [Card.cardFromValueSuit(v,s) for v,s in boardcards[0:4]]
|
cards = [Card.encodeCard(c) for c in boardcards[0:5]]
|
||||||
# hh['boardcard1'] = cards[0]
|
hh['boardcard1'] = cards[0]
|
||||||
# hh['boardcard2'] = cards[1]
|
hh['boardcard2'] = cards[1]
|
||||||
# hh['boardcard3'] = cards[2]
|
hh['boardcard3'] = cards[2]
|
||||||
# hh['boardcard4'] = cards[3]
|
hh['boardcard4'] = cards[3]
|
||||||
# hh['boardcard5'] = cards[4]
|
hh['boardcard5'] = cards[4]
|
||||||
|
print hh
|
||||||
# texture smallint,
|
# texture smallint,
|
||||||
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
||||||
# Needs to be recorded
|
# Needs to be recorded
|
||||||
|
@ -244,7 +243,7 @@ db: a connected fpdb_db object"""
|
||||||
# showdownPot INT, /* pot size at sd/street7 */
|
# showdownPot INT, /* pot size at sd/street7 */
|
||||||
# comment TEXT,
|
# comment TEXT,
|
||||||
# commentTs DATETIME
|
# commentTs DATETIME
|
||||||
# handid = db.storeHand(hh)
|
handid = db.storeHand(hh)
|
||||||
# HandsPlayers - ? ... Do we fix winnings?
|
# HandsPlayers - ? ... Do we fix winnings?
|
||||||
# Tourneys ?
|
# Tourneys ?
|
||||||
# TourneysPlayers
|
# TourneysPlayers
|
||||||
|
|
Loading…
Reference in New Issue
Block a user