more tourney work
- moved HH-based tourney handling completely into Hand - renamed Tourney.py to TourneySummaries - changed many DB fields to allow NULL and removed defaults
This commit is contained in:
parent
18faa5288c
commit
eb3233ac98
|
@ -53,7 +53,6 @@ log = logging.getLogger("db")
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
import SQL
|
import SQL
|
||||||
import Card
|
import Card
|
||||||
import Tourney
|
|
||||||
import Charset
|
import Charset
|
||||||
from Exceptions import *
|
from Exceptions import *
|
||||||
import Configuration
|
import Configuration
|
||||||
|
@ -75,7 +74,7 @@ except ImportError:
|
||||||
use_numpy = False
|
use_numpy = False
|
||||||
|
|
||||||
|
|
||||||
DB_VERSION = 126
|
DB_VERSION = 127
|
||||||
|
|
||||||
|
|
||||||
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
||||||
|
@ -1933,13 +1932,13 @@ 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 createOrUpdateTourneyType(self, tourney):
|
def createOrUpdateTourneyType(self, hand):
|
||||||
tourneyTypeId = 1
|
tourneyTypeId = 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']),
|
||||||
(tourney.tourNo, tourney.siteId)
|
(hand.tourNo, hand.siteId)
|
||||||
)
|
)
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
|
@ -1951,8 +1950,8 @@ class Database:
|
||||||
tourneyTypeId = result[0]
|
tourneyTypeId = 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" % tourneyTypeId)
|
||||||
for ev in expectedValues :
|
for ev in expectedValues :
|
||||||
if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ):
|
if ( getattr( hand, 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( hand, expectedValues.get(ev)), result[ev]) )
|
||||||
tourneyTypeIdMatch = False
|
tourneyTypeIdMatch = False
|
||||||
#break
|
#break
|
||||||
except:
|
except:
|
||||||
|
@ -1962,8 +1961,8 @@ class Database:
|
||||||
if tourneyTypeIdMatch == False :
|
if tourneyTypeIdMatch == False :
|
||||||
# Check for an existing TTypeId that matches tourney info, if not found create it
|
# Check for an existing TTypeId that matches tourney info, if not found create it
|
||||||
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.currency, tourney.buyin, tourney.fee, tourney.isKO,
|
(hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.isKO,
|
||||||
tourney.isRebuy, tourney.isAddOn, tourney.speed, tourney.isShootout, tourney.isMatrix)
|
hand.isRebuy, hand.isRebuy, hand.speed, hand.isShootout, hand.isMatrix)
|
||||||
)
|
)
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
|
@ -1971,46 +1970,46 @@ class Database:
|
||||||
tourneyTypeId = result[0]
|
tourneyTypeId = result[0]
|
||||||
except TypeError: #this means we need to create a new entry
|
except TypeError: #this means we need to create a new entry
|
||||||
cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.siteId, tourney.currency, tourney.buyin, tourney.fee, tourney.buyInChips,
|
(hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.buyInChips,
|
||||||
tourney.isKO, tourney.isRebuy,
|
hand.isKO, hand.isRebuy,
|
||||||
tourney.isAddOn, tourney.speed, tourney.isShootout, tourney.isMatrix)
|
hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix)
|
||||||
)
|
)
|
||||||
tourneyTypeId = self.get_last_insert_id(cursor)
|
tourneyTypeId = self.get_last_insert_id(cursor)
|
||||||
return tourneyTypeId
|
return tourneyTypeId
|
||||||
#end def createOrUpdateTourneyType
|
#end def createOrUpdateTourneyType
|
||||||
|
|
||||||
def createOrUpdateTourney(self, tourney):
|
def createOrUpdateTourney(self, hand):
|
||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.siteId, tourney.tourNo))
|
(hand.siteId, hand.tourNo))
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
if result != None and len(result)==1:
|
if result != None and len(result)==1:
|
||||||
tourneyId = result[0]
|
tourneyId = result[0]
|
||||||
else:
|
else:
|
||||||
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.tourneyTypeId, tourney.tourNo, tourney.entries, tourney.prizepool,
|
(hand.tourneyTypeId, hand.tourNo, None, None,
|
||||||
tourney.startTime, tourney.endTime, tourney.tourneyName, None,
|
hand.startTime, None, None, None,
|
||||||
tourney.totalRebuyCount, tourney.totalAddOnCount))
|
None, None))
|
||||||
tourneyId = self.get_last_insert_id(cursor)
|
tourneyId = self.get_last_insert_id(cursor)
|
||||||
return tourneyId
|
return tourneyId
|
||||||
#end def createOrUpdateTourney
|
#end def createOrUpdateTourney
|
||||||
|
|
||||||
def createOrUpdateTourneysPlayers(self, hand, tourney):
|
def createOrUpdateTourneysPlayers(self, hand):
|
||||||
tourneysPlayersIds=[]
|
tourneysPlayersIds=[]
|
||||||
for player in hand.players:
|
for player in hand.players:
|
||||||
playerId = hand.dbid_pids[player[1]]
|
playerId = hand.dbid_pids[player[1]]
|
||||||
|
|
||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
cursor.execute (self.sql.query['getTourneysPlayersId'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneysPlayersId'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.tourneyId, playerId))
|
(hand.tourneyId, playerId))
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
if result != None and len(result)==1:
|
if result != None and len(result)==1:
|
||||||
tourneysPlayersIds.append(result[0])
|
tourneysPlayersIds.append(result[0])
|
||||||
else:
|
else:
|
||||||
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.tourneyId, playerId, None, None, None, None, None, None, None, None))
|
(hand.tourneyId, playerId, None, None, None, None, None, None, None, None))
|
||||||
tourneysPlayersIds.append(self.get_last_insert_id(cursor))
|
tourneysPlayersIds.append(self.get_last_insert_id(cursor))
|
||||||
return tourneysPlayersIds
|
return tourneysPlayersIds
|
||||||
#end def createOrUpdateTourneysPlayers
|
#end def createOrUpdateTourneysPlayers
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
|
import TourneySummary
|
||||||
|
|
||||||
# Fulltilt HH Format converter
|
# Fulltilt HH Format converter
|
||||||
|
|
||||||
|
@ -227,8 +228,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
hand.buyinCurrency="EUR"
|
hand.buyinCurrency="EUR"
|
||||||
else:
|
else:
|
||||||
hand.buyinCurrency="NA"
|
hand.buyinCurrency="NA"
|
||||||
hand.buyin = 100*Decimal(n.group('BUYIN'))
|
hand.buyin = int(100*Decimal(n.group('BUYIN')))
|
||||||
hand.fee = 100*Decimal(n.group('FEE'))
|
hand.fee = int(100*Decimal(n.group('FEE')))
|
||||||
if n.group('TURBO') is not None :
|
if n.group('TURBO') is not None :
|
||||||
hand.speed = "Turbo"
|
hand.speed = "Turbo"
|
||||||
if n.group('SPECIAL') is not None :
|
if n.group('SPECIAL') is not None :
|
||||||
|
@ -440,7 +441,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
log.info("Too many or too few lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
|
log.info("Too many or too few lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
|
||||||
self.status = False
|
self.status = False
|
||||||
else:
|
else:
|
||||||
self.tourney = Tourney.Tourney(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
|
self.tourney = TourneySummary.TourneySummary(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
|
||||||
self.status = self.getPlayersPositionsAndWinnings(self.tourney)
|
self.status = self.getPlayersPositionsAndWinnings(self.tourney)
|
||||||
if self.status == True :
|
if self.status == True :
|
||||||
self.status = self.determineTourneyType(self.tourney)
|
self.status = self.determineTourneyType(self.tourney)
|
||||||
|
|
|
@ -71,15 +71,18 @@ class Hand(object):
|
||||||
self.buttonpos = 0
|
self.buttonpos = 0
|
||||||
|
|
||||||
#tourney stuff
|
#tourney stuff
|
||||||
self.tourney = None
|
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
|
self.tourneyId = None
|
||||||
|
self.tourneyTypeId = None
|
||||||
self.buyin = None
|
self.buyin = None
|
||||||
self.buyinCurrency = None
|
self.buyinCurrency = None
|
||||||
|
self.buyInChips = 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
|
||||||
self.speed = "Normal"
|
self.speed = "Normal"
|
||||||
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
|
||||||
|
@ -88,6 +91,7 @@ class Hand(object):
|
||||||
self.seating = []
|
self.seating = []
|
||||||
self.players = []
|
self.players = []
|
||||||
self.posted = []
|
self.posted = []
|
||||||
|
self.tourneysPlayersIds = []
|
||||||
|
|
||||||
# Collections indexed by street names
|
# Collections indexed by street names
|
||||||
self.bets = {}
|
self.bets = {}
|
||||||
|
@ -137,10 +141,6 @@ class Hand(object):
|
||||||
("TABLE NAME", self.tablename),
|
("TABLE NAME", self.tablename),
|
||||||
("HERO", self.hero),
|
("HERO", self.hero),
|
||||||
("MAXSEATS", self.maxseats),
|
("MAXSEATS", self.maxseats),
|
||||||
("TOURNAMENT NO", self.tourNo),
|
|
||||||
("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),
|
||||||
|
@ -157,6 +157,19 @@ class Hand(object):
|
||||||
("TOTAL COLLECTED", self.totalcollected),
|
("TOTAL COLLECTED", self.totalcollected),
|
||||||
("RAKE", self.rake),
|
("RAKE", self.rake),
|
||||||
("START TIME", self.startTime),
|
("START TIME", self.startTime),
|
||||||
|
("TOURNAMENT NO", self.tourNo),
|
||||||
|
("TOURNEY ID", self.tourneyId),
|
||||||
|
("TOURNEY TYPE ID", self.tourneyTypeId),
|
||||||
|
("BUYIN", self.buyin),
|
||||||
|
("BUYIN CURRENCY", self.buyinCurrency),
|
||||||
|
("BUYIN CHIPS", self.buyInChips),
|
||||||
|
("FEE", self.fee),
|
||||||
|
("IS REBUY", self.isRebuy),
|
||||||
|
("IS ADDON", self.isAddOn),
|
||||||
|
("IS KO", self.isKO),
|
||||||
|
("IS MATRIX", self.isMatrix),
|
||||||
|
("IS SHOOTOUT", self.isShootout),
|
||||||
|
("TOURNEY COMMENT", self.tourneyComment),
|
||||||
)
|
)
|
||||||
|
|
||||||
structs = ( ("PLAYERS", self.players),
|
structs = ( ("PLAYERS", self.players),
|
||||||
|
@ -171,6 +184,7 @@ class Hand(object):
|
||||||
("BOARD", self.board),
|
("BOARD", self.board),
|
||||||
("DISCARDS", self.discards),
|
("DISCARDS", self.discards),
|
||||||
("HOLECARDS", self.holecards),
|
("HOLECARDS", self.holecards),
|
||||||
|
("TOURNEYS PLAYER IDS", self.tourneysPlayersIds),
|
||||||
)
|
)
|
||||||
str = ''
|
str = ''
|
||||||
for (name, var) in vars:
|
for (name, var) in vars:
|
||||||
|
@ -214,12 +228,11 @@ dealt whether they were seen in a 'dealt to' line
|
||||||
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
||||||
|
|
||||||
if self.tourNo!=None:
|
if self.tourNo!=None:
|
||||||
self.tourney=Tourney.Tourney(self.sitename, self.gametype, None, builtFrom="HHC-HH", hand=self)
|
self.tourneyTypeId = db.createOrUpdateTourneyType(self)
|
||||||
self.tourney.tourneyTypeId = db.createOrUpdateTourneyType(self.tourney)
|
|
||||||
db.commit()
|
db.commit()
|
||||||
self.tourney.tourneyId = db.createOrUpdateTourney(self.tourney)
|
self.tourneyId = db.createOrUpdateTourney(self)
|
||||||
db.commit()
|
db.commit()
|
||||||
self.tourney.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self, self.tourney)
|
self.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self)
|
||||||
db.commit()
|
db.commit()
|
||||||
#end def prepInsert
|
#end def prepInsert
|
||||||
|
|
||||||
|
|
|
@ -256,8 +256,8 @@ class PokerStars(HandHistoryConverter):
|
||||||
hand.buyinCurrency="NA" #FIXME: handle other currencies, FPP, play money
|
hand.buyinCurrency="NA" #FIXME: handle other currencies, FPP, play money
|
||||||
info[key]=info[key][:-4]
|
info[key]=info[key][:-4]
|
||||||
middle=info[key].find("+")
|
middle=info[key].find("+")
|
||||||
hand.buyin = 100*Decimal(info[key][1:middle])
|
hand.buyin = int(100*Decimal(info[key][1:middle]))
|
||||||
hand.fee = 100*Decimal(info[key][middle+2:])
|
hand.fee = int(100*Decimal(info[key][middle+2:]))
|
||||||
if key == 'LEVEL':
|
if key == 'LEVEL':
|
||||||
hand.level = info[key]
|
hand.level = info[key]
|
||||||
|
|
||||||
|
|
|
@ -368,22 +368,22 @@ class Sql:
|
||||||
currency varchar(4) NOT NULL,
|
currency varchar(4) NOT NULL,
|
||||||
buyIn INT NOT NULL,
|
buyIn INT NOT NULL,
|
||||||
fee INT NOT NULL,
|
fee INT NOT NULL,
|
||||||
buyInChips INT NOT NULL,
|
buyInChips INT,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
maxSeats INT,
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT False,
|
rebuy BOOLEAN,
|
||||||
rebuyCost INT,
|
rebuyCost INT,
|
||||||
rebuyChips INT,
|
rebuyChips INT,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT False,
|
addOn BOOLEAN,
|
||||||
addOnCost INT,
|
addOnCost INT,
|
||||||
addOnChips INT,
|
addOnChips INT,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT False,
|
knockout BOOLEAN,
|
||||||
koBounty INT,
|
koBounty INT,
|
||||||
speed varchar(10),
|
speed varchar(10),
|
||||||
shootout BOOLEAN NOT NULL DEFAULT False,
|
shootout BOOLEAN,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT False,
|
matrix BOOLEAN,
|
||||||
sng BOOLEAN NOT NULL DEFAULT False,
|
sng BOOLEAN,
|
||||||
satellite BOOLEAN NOT NULL DEFAULT False,
|
satellite BOOLEAN,
|
||||||
doubleOrNothing BOOLEAN NOT NULL DEFAULT False,
|
doubleOrNothing BOOLEAN,
|
||||||
guarantee INT)
|
guarantee INT)
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif db_server == 'postgresql':
|
elif db_server == 'postgresql':
|
||||||
|
@ -393,22 +393,22 @@ class Sql:
|
||||||
currency varchar(4) NOT NULL,
|
currency varchar(4) NOT NULL,
|
||||||
buyin INT NOT NULL,
|
buyin INT NOT NULL,
|
||||||
fee INT NOT NULL,
|
fee INT NOT NULL,
|
||||||
buyInChips INT NOT NULL,
|
buyInChips INT,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
maxSeats INT,
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT False,
|
rebuy BOOLEAN,
|
||||||
rebuyCost INT,
|
rebuyCost INT,
|
||||||
rebuyChips INT,
|
rebuyChips INT,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT False,
|
addOn BOOLEAN,
|
||||||
addOnCost INT,
|
addOnCost INT,
|
||||||
addOnChips INT,
|
addOnChips INT,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT False,
|
knockout BOOLEAN,
|
||||||
koBounty INT,
|
koBounty INT,
|
||||||
speed varchar(10),
|
speed varchar(10),
|
||||||
shootout BOOLEAN NOT NULL DEFAULT False,
|
shootout BOOLEAN,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT False,
|
matrix BOOLEAN,
|
||||||
sng BOOLEAN NOT NULL DEFAULT False,
|
sng BOOLEAN,
|
||||||
satellite BOOLEAN NOT NULL DEFAULT False,
|
satellite BOOLEAN,
|
||||||
doubleOrNothing BOOLEAN NOT NULL DEFAULT False,
|
doubleOrNothing BOOLEAN,
|
||||||
guarantee INT)"""
|
guarantee INT)"""
|
||||||
elif db_server == 'sqlite':
|
elif db_server == 'sqlite':
|
||||||
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
||||||
|
@ -417,22 +417,22 @@ class Sql:
|
||||||
currency VARCHAR(4) NOT NULL,
|
currency VARCHAR(4) NOT NULL,
|
||||||
buyin INT NOT NULL,
|
buyin INT NOT NULL,
|
||||||
fee INT NOT NULL,
|
fee INT NOT NULL,
|
||||||
buyInChips INT NOT NULL,
|
buyInChips INT,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
maxSeats INT,
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT 0,
|
rebuy BOOLEAN,
|
||||||
rebuyCost INT,
|
rebuyCost INT,
|
||||||
rebuyChips INT,
|
rebuyChips INT,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT 0,
|
addOn BOOLEAN,
|
||||||
addOnCost INT,
|
addOnCost INT,
|
||||||
addOnChips INT,
|
addOnChips INT,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT 0,
|
knockout BOOLEAN,
|
||||||
koBounty INT,
|
koBounty INT,
|
||||||
speed TEXT,
|
speed TEXT,
|
||||||
shootout BOOLEAN NOT NULL DEFAULT 0,
|
shootout BOOLEAN,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT 0,
|
matrix BOOLEAN,
|
||||||
sng BOOLEAN NOT NULL DEFAULT 0,
|
sng BOOLEAN,
|
||||||
satellite BOOLEAN NOT NULL DEFAULT 0,
|
satellite BOOLEAN,
|
||||||
doubleOrNothing BOOLEAN NOT NULL DEFAULT 0,
|
doubleOrNothing BOOLEAN,
|
||||||
guarantee INT)"""
|
guarantee INT)"""
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
@ -442,23 +442,23 @@ class Sql:
|
||||||
if db_server == 'mysql':
|
if db_server == 'mysql':
|
||||||
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
||||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||||
tourneyTypeId SMALLINT UNSIGNED NOT NULL DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||||
siteTourneyNo BIGINT NOT NULL,
|
siteTourneyNo BIGINT NOT NULL,
|
||||||
entries INT NOT NULL,
|
entries INT,
|
||||||
prizepool INT NOT NULL,
|
prizepool INT,
|
||||||
startTime DATETIME NOT NULL,
|
startTime DATETIME NOT NULL,
|
||||||
endTime DATETIME,
|
endTime DATETIME,
|
||||||
tourneyName varchar(40),
|
tourneyName varchar(40),
|
||||||
matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
||||||
totalRebuyCount INT DEFAULT 0,
|
totalRebuyCount INT,
|
||||||
totalAddOnCount INT DEFAULT 0,
|
totalAddOnCount INT,
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
commentTs DATETIME)
|
commentTs DATETIME)
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif db_server == 'postgresql':
|
elif db_server == 'postgresql':
|
||||||
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
||||||
id SERIAL, PRIMARY KEY (id),
|
id SERIAL, PRIMARY KEY (id),
|
||||||
tourneyTypeId INT DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||||
siteTourneyNo BIGINT,
|
siteTourneyNo BIGINT,
|
||||||
entries INT,
|
entries INT,
|
||||||
prizepool INT,
|
prizepool INT,
|
||||||
|
@ -466,14 +466,14 @@ class Sql:
|
||||||
endTime timestamp without time zone,
|
endTime timestamp without time zone,
|
||||||
tourneyName varchar(40),
|
tourneyName varchar(40),
|
||||||
matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
||||||
totalRebuyCount INT DEFAULT 0,
|
totalRebuyCount INT,
|
||||||
totalAddOnCount INT DEFAULT 0,
|
totalAddOnCount INT,
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
commentTs timestamp without time zone)"""
|
commentTs timestamp without time zone)"""
|
||||||
elif db_server == 'sqlite':
|
elif db_server == 'sqlite':
|
||||||
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
tourneyTypeId INT DEFAULT 1,
|
tourneyTypeId INT,
|
||||||
siteTourneyNo INT,
|
siteTourneyNo INT,
|
||||||
entries INT,
|
entries INT,
|
||||||
prizepool INT,
|
prizepool INT,
|
||||||
|
@ -481,8 +481,8 @@ class Sql:
|
||||||
endTime REAL,
|
endTime REAL,
|
||||||
tourneyName TEXT,
|
tourneyName TEXT,
|
||||||
matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
|
||||||
totalRebuyCount INT DEFAULT 0,
|
totalRebuyCount INT,
|
||||||
totalAddOnCount INT DEFAULT 0,
|
totalAddOnCount INT,
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
commentTs REAL)"""
|
commentTs REAL)"""
|
||||||
################################
|
################################
|
||||||
|
|
|
@ -34,7 +34,7 @@ import Card
|
||||||
|
|
||||||
log = logging.getLogger("parser")
|
log = logging.getLogger("parser")
|
||||||
|
|
||||||
class Tourney(object):
|
class TourneySummary(object):
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Class Variables
|
# Class Variables
|
||||||
|
@ -45,7 +45,7 @@ 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", hand=None):
|
def __init__(self, sitename, gametype, summaryText, builtFrom = "HHC"):
|
||||||
self.sitename = sitename
|
self.sitename = sitename
|
||||||
self.siteId = self.SITEIDS[sitename]
|
self.siteId = self.SITEIDS[sitename]
|
||||||
self.gametype = gametype
|
self.gametype = gametype
|
||||||
|
@ -54,23 +54,12 @@ class Tourney(object):
|
||||||
self.tourneyName = None
|
self.tourneyName = None
|
||||||
self.tourneyTypeId = None
|
self.tourneyTypeId = None
|
||||||
self.tourneyId = None
|
self.tourneyId = None
|
||||||
if builtFrom=="HHC":
|
self.startTime = None
|
||||||
self.startTime = None
|
self.endTime = None
|
||||||
self.endTime = None
|
self.tourNo = None
|
||||||
self.tourNo = None
|
self.currency = None
|
||||||
self.currency = None
|
self.buyin = None
|
||||||
self.buyin = None
|
self.fee = None
|
||||||
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
|
Loading…
Reference in New Issue
Block a user