Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
commit
ebbb2afcd3
|
@ -28,6 +28,7 @@ import sys
|
|||
import traceback
|
||||
from datetime import datetime, date, time, timedelta
|
||||
from time import time, strftime, sleep
|
||||
from decimal import Decimal
|
||||
import string
|
||||
import re
|
||||
import logging
|
||||
|
@ -1043,7 +1044,7 @@ class Database:
|
|||
q = "SELECT name, id FROM Players WHERE siteid=%s and name=%s"
|
||||
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))
|
||||
|
||||
|
@ -1121,10 +1122,10 @@ class Database:
|
|||
|
||||
def storeHand(self, p):
|
||||
#stores into table hands:
|
||||
self.cursor.execute ("""INSERT INTO Hands (
|
||||
q = """INSERT INTO Hands (
|
||||
tablename,
|
||||
sitehandno,
|
||||
gametypeid,
|
||||
sitehandno,
|
||||
handstart,
|
||||
importtime,
|
||||
seats,
|
||||
|
@ -1133,58 +1134,63 @@ class Database:
|
|||
boardcard2,
|
||||
boardcard3,
|
||||
boardcard4,
|
||||
boardcard5,
|
||||
-- texture,
|
||||
playersVpi,
|
||||
playersAtStreet1,
|
||||
playersAtStreet2,
|
||||
playersAtStreet3,
|
||||
playersAtStreet4,
|
||||
playersAtShowdown,
|
||||
street0Raises,
|
||||
street1Raises,
|
||||
street2Raises,
|
||||
street3Raises,
|
||||
street4Raises,
|
||||
-- street1Pot,
|
||||
-- street2Pot,
|
||||
-- street3Pot,
|
||||
-- street4Pot,
|
||||
-- showdownPot
|
||||
boardcard5
|
||||
)
|
||||
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['tablename'],
|
||||
p['sitehandno'],
|
||||
p['gametypeid'],
|
||||
(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
||||
%s, %s)"""
|
||||
#--- texture,
|
||||
#-- playersVpi,
|
||||
#-- playersAtStreet1,
|
||||
#-- playersAtStreet2,
|
||||
#-- playersAtStreet3,
|
||||
#-- playersAtStreet4,
|
||||
#-- playersAtShowdown,
|
||||
#-- street0Raises,
|
||||
#-- street1Raises,
|
||||
#-- street2Raises,
|
||||
#-- street3Raises,
|
||||
#-- street4Raises,
|
||||
#-- street1Pot,
|
||||
#-- street2Pot,
|
||||
#-- street3Pot,
|
||||
#-- street4Pot,
|
||||
#-- showdownPot
|
||||
#-- seats,
|
||||
|
||||
q = q.replace('%s', self.sql.query['placeholder'])
|
||||
print "DEBUG: p: %s" %p
|
||||
print "DEBUG: gtid: %s" % p['gameTypeId']
|
||||
self.cursor.execute(q, (
|
||||
p['tableName'],
|
||||
p['gameTypeId'],
|
||||
p['siteHandNo'],
|
||||
p['handStart'],
|
||||
datetime.datetime.today(),
|
||||
len(p['names']),
|
||||
datetime.today(), #importtime
|
||||
# len(p['names']), #seats
|
||||
p['maxSeats'],
|
||||
p['seats'],
|
||||
p['boardcard1'],
|
||||
p['boardcard2'],
|
||||
p['boardcard3'],
|
||||
p['boardcard4'],
|
||||
p['boardcard5'],
|
||||
hudCache['playersVpi'],
|
||||
hudCache['playersAtStreet1'],
|
||||
hudCache['playersAtStreet2'],
|
||||
hudCache['playersAtStreet3'],
|
||||
hudCache['playersAtStreet4'],
|
||||
hudCache['playersAtShowdown'],
|
||||
hudCache['street0Raises'],
|
||||
hudCache['street1Raises'],
|
||||
hudCache['street2Raises'],
|
||||
hudCache['street3Raises'],
|
||||
hudCache['street4Raises'],
|
||||
hudCache['street1Pot'],
|
||||
hudCache['street2Pot'],
|
||||
hudCache['street3Pot'],
|
||||
hudCache['street4Pot'],
|
||||
hudCache['showdownPot']
|
||||
)
|
||||
p['boardcard5'])
|
||||
# hudCache['playersVpi'],
|
||||
# hudCache['playersAtStreet1'],
|
||||
# hudCache['playersAtStreet2'],
|
||||
# hudCache['playersAtStreet3'],
|
||||
# hudCache['playersAtStreet4'],
|
||||
# hudCache['playersAtShowdown'],
|
||||
# hudCache['street0Raises'],
|
||||
# hudCache['street1Raises'],
|
||||
# hudCache['street2Raises'],
|
||||
# hudCache['street3Raises'],
|
||||
# hudCache['street4Raises'],
|
||||
# hudCache['street1Pot'],
|
||||
# hudCache['street2Pot'],
|
||||
# hudCache['street3Pot'],
|
||||
# hudCache['street4Pot'],
|
||||
# hudCache['showdownPot']
|
||||
)
|
||||
#return getLastInsertId(backend, conn, cursor)
|
||||
# def storeHand
|
||||
|
|
|
@ -185,31 +185,51 @@ db: a connected fpdb_db object"""
|
|||
# TODO:
|
||||
# Players - base playerid and siteid tuple
|
||||
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
||||
|
||||
#Gametypes
|
||||
|
||||
print "DEBUG: self.gametype %s" % self.gametype
|
||||
#Nice way to discover if the game is already listed in the db?
|
||||
#Also this is using an old method from fpdb_simple - should probably conform to the rest of the inserts
|
||||
|
||||
hilo = "h"
|
||||
if self.gametype['category'] in ['studhilo', 'omahahilo']:
|
||||
hilo = "s"
|
||||
elif self.gametype['category'] in ['razz','27_3draw','badugi']:
|
||||
hilo = "l"
|
||||
|
||||
gtid = db.insertGameTypes( (self.siteId, self.gametype['type'], self.gametype['base'],
|
||||
self.gametype['category'], self.gametype['limitType'], hilo,
|
||||
int(Decimal(self.gametype['sb'])*100), int(Decimal(self.gametype['bb'])*100), 0, 0) )
|
||||
|
||||
|
||||
# HudCache data to come from DerivedStats class
|
||||
# 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
|
||||
#hh['siteHandNo'] = self.handid
|
||||
# gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
#
|
||||
#hh['handStart'] = self.starttime
|
||||
# seats TINYINT NOT NULL,
|
||||
#
|
||||
#hh['tableName'] = self.tablenam
|
||||
#hh['maxSeats'] = self.maxseats
|
||||
#This should be moved to prepInsert
|
||||
hh = {}
|
||||
hh['siteHandNo'] = self.handid
|
||||
hh['handStart'] = self.starttime
|
||||
hh['gameTypeId'] = gtid[0]
|
||||
# seats TINYINT NOT NULL,
|
||||
hh['tableName'] = self.tablename
|
||||
hh['maxSeats'] = self.maxseats
|
||||
hh['seats'] = len(sqlids)
|
||||
# boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||
# boardcard2 smallint,
|
||||
# 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]
|
||||
# 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]
|
||||
|
||||
print hh
|
||||
# texture smallint,
|
||||
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
||||
# Needs to be recorded
|
||||
|
@ -244,7 +264,7 @@ db: a connected fpdb_db object"""
|
|||
# showdownPot INT, /* pot size at sd/street7 */
|
||||
# comment TEXT,
|
||||
# commentTs DATETIME
|
||||
# handid = db.storeHand(hh)
|
||||
handid = db.storeHand(hh)
|
||||
# HandsPlayers - ? ... Do we fix winnings?
|
||||
# Tourneys ?
|
||||
# TourneysPlayers
|
||||
|
|
Loading…
Reference in New Issue
Block a user