store Tourneys and TourneyTypes for PS tourneys. see ML for more details
This commit is contained in:
parent
be68f56c1b
commit
d01435d068
|
@ -1933,9 +1933,9 @@ class Database:
|
||||||
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||||
# end def send_finish_msg():
|
# end def send_finish_msg():
|
||||||
|
|
||||||
def recogniseTourneyType(self, tourney):
|
def getTourneyTypeId(self, tourney):
|
||||||
log.debug("Database.recogniseTourneyType")
|
tourneyTypeId = 1
|
||||||
typeId = 1
|
|
||||||
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
|
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
|
||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||||
|
@ -1945,47 +1945,61 @@ class Database:
|
||||||
|
|
||||||
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
|
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
|
||||||
7 : "isShootout", 8 : "isMatrix" }
|
7 : "isShootout", 8 : "isMatrix" }
|
||||||
typeIdMatch = True
|
tourneyTypeIdMatch = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
len(result)
|
tourneyTypeId = result[0]
|
||||||
typeId = result[0]
|
log.debug("Tourney found in db with Tourney_Type_ID = %d" % tourneyTypeId)
|
||||||
log.debug("Tourney found in db with Tourney_Type_ID = %d" % typeId)
|
|
||||||
for ev in expectedValues :
|
for ev in expectedValues :
|
||||||
if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ):
|
if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ):
|
||||||
log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( tourney, expectedValues.get(ev)), result[ev]) )
|
log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( tourney, expectedValues.get(ev)), result[ev]) )
|
||||||
typeIdMatch = False
|
tourneyTypeIdMatch = False
|
||||||
#break
|
#break
|
||||||
except:
|
except:
|
||||||
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
|
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
|
||||||
typeIdMatch = False
|
tourneyTypeIdMatch = False
|
||||||
|
|
||||||
if typeIdMatch == False :
|
if tourneyTypeIdMatch == False :
|
||||||
# Check for an existing TTypeId that matches tourney info (buyin/fee, knockout, rebuy, speed, matrix, shootout)
|
# Check for an existing TTypeId that matches tourney info, if not found create it
|
||||||
# if not found create it
|
|
||||||
log.debug("Searching for a TourneyTypeId matching TourneyType data")
|
|
||||||
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO,
|
(tourney.siteId, tourney.currency, tourney.buyin, tourney.fee, tourney.isKO,
|
||||||
tourney.isRebuy, tourney.speed, tourney.isShootout, tourney.isMatrix)
|
tourney.isRebuy, tourney.isAddOn, tourney.speed, tourney.isShootout, tourney.isMatrix)
|
||||||
)
|
)
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
len(result)
|
tourneyTypeId = result[0]
|
||||||
typeId = result[0]
|
|
||||||
log.debug("Existing Tourney Type Id found : %d" % typeId)
|
|
||||||
except TypeError: #this means we need to create a new entry
|
except TypeError: #this means we need to create a new entry
|
||||||
log.debug("Tourney Type Id not found : create one")
|
cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
|
||||||
cursor.execute (self.sql.query['insertTourneyTypes'].replace('%s', self.sql.query['placeholder']),
|
(tourney.siteId, tourney.currency, tourney.buyin, tourney.fee, tourney.buyInChips,
|
||||||
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO, tourney.isRebuy,
|
tourney.isKO, tourney.isRebuy,
|
||||||
tourney.speed, tourney.isShootout, tourney.isMatrix)
|
tourney.isAddOn, tourney.speed, tourney.isShootout, tourney.isMatrix)
|
||||||
)
|
)
|
||||||
typeId = self.get_last_insert_id(cursor)
|
tourneyTypeId = self.get_last_insert_id(cursor)
|
||||||
|
return tourneyTypeId
|
||||||
|
#end def getTourneyTypeId
|
||||||
|
|
||||||
return typeId
|
def getTourneyId(self, tourney):
|
||||||
#end def recogniseTourneyType
|
cursor = self.get_cursor()
|
||||||
|
cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||||
|
(tourney.siteId, tourney.tourNo))
|
||||||
|
result=cursor.fetchone()
|
||||||
|
|
||||||
|
try:
|
||||||
|
tourneyId = result[0]
|
||||||
|
except:
|
||||||
|
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||||
|
(tourney.tourneyTypeId, tourney.tourNo, tourney.entries, tourney.prizepool,
|
||||||
|
tourney.startTime, tourney.endTime, tourney.tourneyName, None,
|
||||||
|
tourney.totalRebuyCount, tourney.totalAddOnCount))
|
||||||
|
tourneyId = self.get_last_insert_id(cursor)
|
||||||
|
return tourneyId
|
||||||
|
#end def getTourneyId
|
||||||
|
|
||||||
|
def getTourneysPlayersIds(self, tourney):
|
||||||
|
print "TODO implement getTourneysPlayersIds"
|
||||||
|
#end def getTourneysPlayersIds
|
||||||
|
#end class Database
|
||||||
|
|
||||||
# Class used to hold all the data needed to write a hand to the db
|
# Class used to hold all the data needed to write a hand to the db
|
||||||
# mainParser() in fpdb_parse_logic.py creates one of these and then passes it to
|
# mainParser() in fpdb_parse_logic.py creates one of these and then passes it to
|
||||||
|
|
|
@ -37,7 +37,7 @@ import Configuration
|
||||||
from Exceptions import *
|
from Exceptions import *
|
||||||
import DerivedStats
|
import DerivedStats
|
||||||
import Card
|
import Card
|
||||||
|
import Tourney
|
||||||
|
|
||||||
class Hand(object):
|
class Hand(object):
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class Hand(object):
|
||||||
self.siteId = self.SITEIDS[sitename]
|
self.siteId = self.SITEIDS[sitename]
|
||||||
self.stats = DerivedStats.DerivedStats(self)
|
self.stats = DerivedStats.DerivedStats(self)
|
||||||
self.gametype = gametype
|
self.gametype = gametype
|
||||||
self.starttime = 0
|
self.startTime = 0
|
||||||
self.handText = handText
|
self.handText = handText
|
||||||
self.handid = 0
|
self.handid = 0
|
||||||
self.cancelled = False
|
self.cancelled = False
|
||||||
|
@ -69,12 +69,15 @@ class Hand(object):
|
||||||
self.maxseats = None
|
self.maxseats = None
|
||||||
self.counted_seats = 0
|
self.counted_seats = 0
|
||||||
self.buttonpos = 0
|
self.buttonpos = 0
|
||||||
|
|
||||||
|
#tourney stuff
|
||||||
|
self.tourney = None
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
self.buyin = None
|
self.buyin = None
|
||||||
|
self.buyinCurrency = None
|
||||||
self.fee = None # the Database code is looking for this one .. ?
|
self.fee = None # the Database code is looking for this one .. ?
|
||||||
self.level = None
|
self.level = None
|
||||||
self.mixed = None
|
self.mixed = None
|
||||||
# Some attributes for hand from a tourney
|
|
||||||
self.speed = "Normal"
|
self.speed = "Normal"
|
||||||
self.isRebuy = False
|
self.isRebuy = False
|
||||||
self.isKO = False
|
self.isKO = False
|
||||||
|
@ -136,6 +139,8 @@ class Hand(object):
|
||||||
("MAXSEATS", self.maxseats),
|
("MAXSEATS", self.maxseats),
|
||||||
("TOURNAMENT NO", self.tourNo),
|
("TOURNAMENT NO", self.tourNo),
|
||||||
("BUYIN", self.buyin),
|
("BUYIN", self.buyin),
|
||||||
|
("BUYIN CURRENCY", self.buyinCurrency),
|
||||||
|
("FEE", self.fee),
|
||||||
("LEVEL", self.level),
|
("LEVEL", self.level),
|
||||||
("MIXED", self.mixed),
|
("MIXED", self.mixed),
|
||||||
("LASTBET", self.lastBet),
|
("LASTBET", self.lastBet),
|
||||||
|
@ -151,7 +156,7 @@ class Hand(object):
|
||||||
("TOTAL POT", self.totalpot),
|
("TOTAL POT", self.totalpot),
|
||||||
("TOTAL COLLECTED", self.totalcollected),
|
("TOTAL COLLECTED", self.totalcollected),
|
||||||
("RAKE", self.rake),
|
("RAKE", self.rake),
|
||||||
("START TIME", self.starttime),
|
("START TIME", self.startTime),
|
||||||
)
|
)
|
||||||
|
|
||||||
structs = ( ("PLAYERS", self.players),
|
structs = ( ("PLAYERS", self.players),
|
||||||
|
@ -208,6 +213,16 @@ dealt whether they were seen in a 'dealt to' line
|
||||||
#Gametypes
|
#Gametypes
|
||||||
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
||||||
|
|
||||||
|
if self.tourNo!=None:
|
||||||
|
self.tourney=Tourney.Tourney(self.sitename, self.gametype, None, builtFrom="HHC-HH", hand=self)
|
||||||
|
self.tourney.tourneyTypeId = db.getTourneyTypeId(self.tourney)
|
||||||
|
db.commit()
|
||||||
|
self.tourney.tourneyId = db.getTourneyId(self.tourney)
|
||||||
|
db.commit()
|
||||||
|
self.tourney.tourneysPlayersIds = db.getTourneysPlayersIds(self.tourney)
|
||||||
|
db.commit()
|
||||||
|
#end def prepInsert
|
||||||
|
|
||||||
def insert(self, db):
|
def insert(self, db):
|
||||||
""" 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
|
||||||
|
@ -231,15 +246,14 @@ db: a connected Database object"""
|
||||||
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers())
|
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers())
|
||||||
# HandsActions - all actions for all players for all streets - self.actions
|
# HandsActions - all actions for all players for all streets - self.actions
|
||||||
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
||||||
# Tourneys ?
|
print "TODO: store TourneysPlayers"
|
||||||
# TourneysPlayers
|
|
||||||
else:
|
else:
|
||||||
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
|
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
|
||||||
self.is_duplicate = True # i.e. don't update hudcache
|
self.is_duplicate = True # i.e. don't update hudcache
|
||||||
raise FpdbHandDuplicate(hh['siteHandNo'])
|
raise FpdbHandDuplicate(hh['siteHandNo'])
|
||||||
|
|
||||||
def updateHudCache(self, db):
|
def updateHudCache(self, db):
|
||||||
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.starttime, self.stats.getHandsPlayers())
|
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.startTime, self.stats.getHandsPlayers())
|
||||||
|
|
||||||
def select(self, handId):
|
def select(self, handId):
|
||||||
""" Function to create Hand object from database """
|
""" Function to create Hand object from database """
|
||||||
|
@ -602,10 +616,10 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString())
|
gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
timestr = datetime.datetime.strftime(self.starttime, '%Y/%m/%d %H:%M:%S ET')
|
timestr = datetime.datetime.strftime(self.startTime, '%Y/%m/%d %H:%M:%S ET')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.starttime
|
print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.startTime
|
||||||
print "*** Make sure your HandHistoryConverter is setting hand.starttime properly!"
|
print "*** Make sure your HandHistoryConverter is setting hand.startTime properly!"
|
||||||
print "*** Game String:", gs
|
print "*** Game String:", gs
|
||||||
return gs
|
return gs
|
||||||
else:
|
else:
|
||||||
|
@ -805,7 +819,7 @@ class HoldemOmahaHand(Hand):
|
||||||
T.h1[
|
T.h1[
|
||||||
T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)],
|
T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)],
|
||||||
T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ],
|
T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ],
|
||||||
T.span(class_='date')[ datetime.datetime.strftime(self.starttime,'%Y/%m/%d - %H:%M:%S ET') ]
|
T.span(class_='date')[ datetime.datetime.strftime(self.startTime,'%Y/%m/%d - %H:%M:%S ET') ]
|
||||||
],
|
],
|
||||||
T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename,
|
T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename,
|
||||||
self.maxseats, self.buttonpos)],
|
self.maxseats, self.buttonpos)],
|
||||||
|
@ -1555,7 +1569,7 @@ limit 1""", {'handid':handid})
|
||||||
SELECT
|
SELECT
|
||||||
h.sitehandno as hid,
|
h.sitehandno as hid,
|
||||||
h.tablename as table,
|
h.tablename as table,
|
||||||
h.handstart as starttime
|
h.handstart as startTime
|
||||||
FROM
|
FROM
|
||||||
hands as h
|
hands as h
|
||||||
WHERE h.id = %(handid)s
|
WHERE h.id = %(handid)s
|
||||||
|
@ -1563,7 +1577,7 @@ WHERE h.id = %(handid)s
|
||||||
res = c.fetchone()
|
res = c.fetchone()
|
||||||
h.handid = res[0]
|
h.handid = res[0]
|
||||||
h.tablename = res[1]
|
h.tablename = res[1]
|
||||||
h.starttime = res[2] # automatically a datetime
|
h.startTime = res[2] # automatically a datetime
|
||||||
|
|
||||||
# PlayerStacks
|
# PlayerStacks
|
||||||
c.execute("""
|
c.execute("""
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
# PokerStars HH Format
|
# PokerStars HH Format
|
||||||
|
|
||||||
|
@ -241,12 +242,22 @@ class PokerStars(HandHistoryConverter):
|
||||||
if key == 'TOURNO':
|
if key == 'TOURNO':
|
||||||
hand.tourNo = info[key]
|
hand.tourNo = info[key]
|
||||||
if key == 'BUYIN':
|
if key == 'BUYIN':
|
||||||
|
if hand.tourNo!=None:
|
||||||
if info[key] == 'Freeroll':
|
if info[key] == 'Freeroll':
|
||||||
hand.buyin = '$0+$0'
|
hand.buyin = 0
|
||||||
|
hand.fee = 0
|
||||||
|
hand.buyinCurrency = "FREE"
|
||||||
else:
|
else:
|
||||||
#FIXME: The key looks like: '€0.82+€0.18 EUR'
|
if info[key].find("$")!=-1:
|
||||||
# This should be parsed properly and used
|
hand.buyinCurrency="USD"
|
||||||
hand.buyin = info[key]
|
elif info[key].find(u"€")!=-1:
|
||||||
|
hand.buyinCurrency="EUR"
|
||||||
|
else:
|
||||||
|
hand.buyinCurrency="NA" #FIXME: handle other currencies, FPP, play money
|
||||||
|
info[key]=info[key][:-4]
|
||||||
|
middle=info[key].find("+")
|
||||||
|
hand.buyin = 100*Decimal(info[key][1:middle])
|
||||||
|
hand.fee = 100*Decimal(info[key][middle+2:])
|
||||||
if key == 'LEVEL':
|
if key == 'LEVEL':
|
||||||
hand.level = info[key]
|
hand.level = info[key]
|
||||||
|
|
||||||
|
|
|
@ -3599,6 +3599,7 @@ class Sql:
|
||||||
self.query['getTourneyTypeId'] = """SELECT id
|
self.query['getTourneyTypeId'] = """SELECT id
|
||||||
FROM TourneyTypes
|
FROM TourneyTypes
|
||||||
WHERE siteId=%s
|
WHERE siteId=%s
|
||||||
|
AND currency=%s
|
||||||
AND buyin=%s
|
AND buyin=%s
|
||||||
AND fee=%s
|
AND fee=%s
|
||||||
AND knockout=%s
|
AND knockout=%s
|
||||||
|
@ -3609,34 +3610,23 @@ class Sql:
|
||||||
AND matrix=%s
|
AND matrix=%s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.query['insertTourneyTypes'] = """INSERT INTO TourneyTypes
|
self.query['insertTourneyType'] = """INSERT INTO TourneyTypes
|
||||||
(siteId, buyin, fee, knockout, rebuy, addOn
|
(siteId, currency, buyin, fee, buyInChips, knockout, rebuy,
|
||||||
,speed, shootout, matrix)
|
addOn ,speed, shootout, matrix)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.query['getTourney'] = """SELECT t.id,
|
self.query['getTourneyIdByTourneyNo'] = """SELECT t.id
|
||||||
t.tourneyTypeId,
|
|
||||||
t.entries,
|
|
||||||
t.prizepool,
|
|
||||||
t.startTime,
|
|
||||||
t.endTime,
|
|
||||||
t.tourneyName,
|
|
||||||
t.matrixIdProcessed,
|
|
||||||
t.totalRebuyCount,
|
|
||||||
t.totalAddOnCount,
|
|
||||||
t.comment
|
|
||||||
FROM Tourneys t
|
FROM Tourneys t
|
||||||
INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id)
|
INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id)
|
||||||
WHERE t.siteTourneyNo=%s AND tt.siteId=%s
|
WHERE tt.siteId=%s AND t.siteTourneyNo=%s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.query['insertTourney'] = """INSERT INTO Tourneys
|
self.query['insertTourney'] = """INSERT INTO Tourneys
|
||||||
(tourneyTypeId, siteTourneyNo, entries, prizepool,
|
(tourneyTypeId, siteTourneyNo, entries, prizepool,
|
||||||
startTime, endTime, tourneyName, matrixIdProcessed,
|
startTime, endTime, tourneyName, matrixIdProcessed,
|
||||||
totalRebuyCount, totalAddOnCount, comment, commentTs)
|
totalRebuyCount, totalAddOnCount)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||||
%s, %s)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.query['updateTourney'] = """UPDATE Tourneys
|
self.query['updateTourney'] = """UPDATE Tourneys
|
||||||
|
|
|
@ -45,25 +45,41 @@ class Tourney(object):
|
||||||
SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9 }
|
SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9 }
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, sitename, gametype, summaryText, builtFrom = "HHC"):
|
def __init__(self, sitename, gametype, summaryText, builtFrom = "HHC", hand=None):
|
||||||
self.sitename = sitename
|
self.sitename = sitename
|
||||||
self.siteId = self.SITEIDS[sitename]
|
self.siteId = self.SITEIDS[sitename]
|
||||||
self.gametype = gametype
|
self.gametype = gametype
|
||||||
self.starttime = None
|
|
||||||
self.endtime = None
|
|
||||||
self.summaryText = summaryText
|
self.summaryText = summaryText
|
||||||
self.tourneyName = None
|
self.tourneyName = None
|
||||||
|
self.tourneyTypeId = None
|
||||||
|
self.tourneyId = None
|
||||||
|
if builtFrom=="HHC":
|
||||||
|
self.startTime = None
|
||||||
|
self.endTime = None
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
|
self.currency = None
|
||||||
self.buyin = None
|
self.buyin = None
|
||||||
self.fee = None # the Database code is looking for this one .. ?
|
self.fee = None
|
||||||
|
elif builtFrom=="HHC-HH":
|
||||||
|
self.startTime = hand.startTime
|
||||||
|
#since tourney.startTime should only be stored to DB when the first hand of a tourney is imported this should actually be correct
|
||||||
|
self.endTime = hand.startTime #TODO parse this
|
||||||
|
self.tourNo = hand.tourNo
|
||||||
|
self.currency = hand.buyinCurrency
|
||||||
|
self.buyin = int(hand.buyin)
|
||||||
|
self.fee = int(hand.fee)
|
||||||
|
else:
|
||||||
|
print "need to bail"
|
||||||
self.hero = None
|
self.hero = None
|
||||||
self.maxseats = None
|
self.maxseats = None
|
||||||
self.entries = 0
|
self.entries = 0
|
||||||
self.speed = "Normal"
|
self.speed = "Normal"
|
||||||
self.prizepool = None # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??}
|
self.prizepool = 0 # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??}
|
||||||
self.buyInChips = None
|
self.buyInChips = 0
|
||||||
self.mixed = None
|
self.mixed = None
|
||||||
self.isRebuy = False
|
self.isRebuy = False
|
||||||
|
self.isAddOn = False
|
||||||
self.isKO = False
|
self.isKO = False
|
||||||
self.isMatrix = False
|
self.isMatrix = False
|
||||||
self.isShootout = False
|
self.isShootout = False
|
||||||
|
@ -99,10 +115,12 @@ class Tourney(object):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
#TODO : Update
|
#TODO : Update
|
||||||
vars = ( ("SITE", self.sitename),
|
vars = ( ("SITE", self.sitename),
|
||||||
("START TIME", self.starttime),
|
("START TIME", self.startTime),
|
||||||
("END TIME", self.endtime),
|
("END TIME", self.endTime),
|
||||||
("TOURNEY NAME", self.tourneyName),
|
("TOURNEY NAME", self.tourneyName),
|
||||||
("TOURNEY NO", self.tourNo),
|
("TOURNEY NO", self.tourNo),
|
||||||
|
("TOURNEY TYPE ID", self.tourneyTypeId),
|
||||||
|
("TOURNEY ID", self.tourneyId),
|
||||||
("BUYIN", self.buyin),
|
("BUYIN", self.buyin),
|
||||||
("FEE", self.fee),
|
("FEE", self.fee),
|
||||||
("HERO", self.hero),
|
("HERO", self.hero),
|
||||||
|
@ -112,7 +130,8 @@ class Tourney(object):
|
||||||
("PRIZE POOL", self.prizepool),
|
("PRIZE POOL", self.prizepool),
|
||||||
("STARTING CHIP COUNT", self.buyInChips),
|
("STARTING CHIP COUNT", self.buyInChips),
|
||||||
("MIXED", self.mixed),
|
("MIXED", self.mixed),
|
||||||
("REBUY ADDON", self.isRebuy),
|
("REBUY", self.isRebuy),
|
||||||
|
("ADDON", self.isAddOn),
|
||||||
("KO", self.isKO),
|
("KO", self.isKO),
|
||||||
("MATRIX", self.isMatrix),
|
("MATRIX", self.isMatrix),
|
||||||
("SHOOTOUT", self.isShootout),
|
("SHOOTOUT", self.isShootout),
|
||||||
|
@ -152,10 +171,9 @@ class Tourney(object):
|
||||||
def getSummaryText(self):
|
def getSummaryText(self):
|
||||||
return self.summaryText
|
return self.summaryText
|
||||||
|
|
||||||
def prepInsert(self, db):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def insert(self, db):
|
def insert(self, db):
|
||||||
|
# Note that this method is not used by the PS tourney storage stuff - this is for summary files only
|
||||||
|
|
||||||
# First : check all needed info is filled in the object, especially for the initial select
|
# First : check all needed info is filled in the object, especially for the initial select
|
||||||
|
|
||||||
# Notes on DB Insert
|
# Notes on DB Insert
|
||||||
|
@ -166,7 +184,7 @@ class Tourney(object):
|
||||||
# Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file
|
# Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file
|
||||||
# Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ??
|
# Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ??
|
||||||
|
|
||||||
dbTourneyTypeId = db.recogniseTourneyType(self)
|
dbTourneyTypeId = db.getTourneyTypeId(self)
|
||||||
logging.debug("Tourney Type ID = %d" % dbTourneyTypeId)
|
logging.debug("Tourney Type ID = %d" % dbTourneyTypeId)
|
||||||
dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId)
|
dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId)
|
||||||
logging.debug("Tourney ID = %d" % dbTourneyId)
|
logging.debug("Tourney ID = %d" % dbTourneyId)
|
||||||
|
@ -317,7 +335,7 @@ limit 1""", {'handid':handid})
|
||||||
SELECT
|
SELECT
|
||||||
h.sitehandno as hid,
|
h.sitehandno as hid,
|
||||||
h.tablename as table,
|
h.tablename as table,
|
||||||
h.handstart as starttime
|
h.handstart as startTime
|
||||||
FROM
|
FROM
|
||||||
hands as h
|
hands as h
|
||||||
WHERE h.id = %(handid)s
|
WHERE h.id = %(handid)s
|
||||||
|
@ -325,7 +343,7 @@ WHERE h.id = %(handid)s
|
||||||
res = c.fetchone()
|
res = c.fetchone()
|
||||||
h.handid = res[0]
|
h.handid = res[0]
|
||||||
h.tablename = res[1]
|
h.tablename = res[1]
|
||||||
h.starttime = res[2] # automatically a datetime
|
h.startTime = res[2] # automatically a datetime
|
||||||
|
|
||||||
# PlayerStacks
|
# PlayerStacks
|
||||||
c.execute("""
|
c.execute("""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user