From 706ce46a9f06c71a7eaa52a21ed5f6941da5e1c0 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 20 Jun 2009 07:58:53 +0800 Subject: [PATCH] Boardcards for Hands table in new importer --- pyfpdb/Hand.py | 9 +++++++++ pyfpdb/fpdb_db.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 6849a32c..38c3609b 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -111,6 +111,14 @@ db: a connected fpdb_db object""" # boardcard3 smallint, # boardcard4 smallint, # boardcard5 smallint, + # 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'] + # cards = [Card.cardFromValueSuit(v,s) for v,s in boardcards[0:4]] + # 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 @@ -194,6 +202,7 @@ If a player has None chips he won't be added.""" def setCommunityCards(self, street, cards): logging.debug("setCommunityCards %s %s" %(street, cards)) self.board[street] = [self.card(c) for c in cards] + print "DEBUG: self.board: %s" % self.board def card(self,c): """upper case the ranks but not suits, 'atjqk' => 'ATJQK'""" diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 201b98fd..29817af9 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -630,6 +630,7 @@ class fpdb_db: #stores into table hands: self.cursor.execute ("""INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats, tableName, importTime, maxSeats + ,boardcard1, boardcard2, boardcard3, boardcard4, boardcard5 ,playersVpi, playersAtStreet1, playersAtStreet2 ,playersAtStreet3, playersAtStreet4, playersAtShowdown ,street0Raises, street1Raises, street2Raises @@ -640,6 +641,7 @@ class fpdb_db: VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" ,(p['siteHandNo'], gametype_id, p['handStart'], len(names), p['tableName'], datetime.datetime.today(), p['maxSeats'] + ,p['boardcard1'], ['boardcard2'], p['boardcard3'], ['boardcard4'], ['boardcard5'] ,hudCache['playersVpi'], hudCache['playersAtStreet1'], hudCache['playersAtStreet2'] ,hudCache['playersAtStreet3'], hudCache['playersAtStreet4'], hudCache['playersAtShowdown'] ,hudCache['street0Raises'], hudCache['street1Raises'], hudCache['street2Raises']