changed TourneyTypes as discussed, some currency-related fixes
I haven't expanded all queries etc. to include the new fields as that code is not currently used by anything and can be expanded as needed
This commit is contained in:
parent
90ff0559b3
commit
0477c73801
|
@ -375,7 +375,7 @@ class Tourney(MappedBase):
|
||||||
|
|
||||||
|
|
||||||
class TourneyType(MappedBase):
|
class TourneyType(MappedBase):
|
||||||
"""Class reflecting TourneysType db table"""
|
"""Class reflecting TourneyType db table"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_or_create(cls, session, **kwargs):
|
def get_or_create(cls, session, **kwargs):
|
||||||
|
|
|
@ -371,16 +371,25 @@ tourney_types_table = Table('TourneyTypes', metadata,
|
||||||
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False),
|
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False),
|
||||||
Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
|
Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
|
||||||
Column('buyin', Integer, nullable=False), # INT NOT NULL
|
Column('buyin', Integer, nullable=False), # INT NOT NULL
|
||||||
Column('fee', Integer, nullable=False, default=0), # INT NOT NULL
|
Column('fee', Integer, nullable=False), # INT NOT NULL
|
||||||
|
Column('buyInChips', Integer, nullable=False), # INT NOT NULL
|
||||||
Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1
|
Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1
|
||||||
Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
|
||||||
Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('rebuyCost', Integer), # INT
|
||||||
|
Column('rebuyChips', Integer), # INT
|
||||||
Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('addOnCost', Integer), # INT
|
||||||
|
Column('addOnChips', Integer), # INT
|
||||||
|
Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('koBounty', Integer), # INT
|
||||||
Column('speed', String(10)), # varchar(10)
|
Column('speed', String(10)), # varchar(10)
|
||||||
Column('headsUp', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('headsUp', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
Column('matrix', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('matrix', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
Column('sng', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
Column('sng', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('satellite', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('doubleOrNothing', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
|
Column('guarantee', Integer, nullable=False, default=0), # INT NOT NULL DEFAULT 0
|
||||||
mysql_charset='utf8',
|
mysql_charset='utf8',
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
)
|
)
|
||||||
|
|
|
@ -75,7 +75,7 @@ except ImportError:
|
||||||
use_numpy = False
|
use_numpy = False
|
||||||
|
|
||||||
|
|
||||||
DB_VERSION = 120
|
DB_VERSION = 121
|
||||||
|
|
||||||
|
|
||||||
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
||||||
|
@ -1357,18 +1357,17 @@ class Database:
|
||||||
c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')")
|
||||||
c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
|
||||||
if self.backend == self.SQLITE:
|
if self.backend == self.SQLITE:
|
||||||
c.execute("""INSERT INTO TourneyTypes (id, siteId, buyin, fee, maxSeats, knockout
|
c.execute("""INSERT INTO TourneyTypes (id, siteId, currency, buyin, fee, buyInChips, maxSeats, knockout
|
||||||
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
||||||
VALUES (NULL, 1, 0, 0, False, False, False, NULL, False, False, False);""")
|
VALUES (NULL, 1, 'USD', 0, 0, 0, False, False, False, NULL, False, False, False);""")
|
||||||
elif self.backend == self.PGSQL:
|
elif self.backend == self.PGSQL:
|
||||||
c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout
|
c.execute("""insert into TourneyTypes(siteId, currency, buyin, fee, buyInChips, maxSeats, knockout
|
||||||
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
||||||
values (1, 0, 0, 0, False, False, False, null, False, False, False);""")
|
values (1, 'USD', 0, 0, 0, 0, False, False, False, null, False, False, False);""")
|
||||||
elif self.backend == self.MYSQL_INNODB:
|
elif self.backend == self.MYSQL_INNODB:
|
||||||
c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout
|
c.execute("""insert into TourneyTypes(id, siteId, currency, buyin, fee, buyInChips, maxSeats, knockout
|
||||||
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
,rebuy, addOn, speed, headsUp, shootout, matrix)
|
||||||
values (DEFAULT, 1, 0, 0, 0, False, False, False, null, False, False, False);""")
|
values (DEFAULT, 1, 'USD', 0, 0, 0, 0, False, False, False, null, False, False, False);""")
|
||||||
|
|
||||||
#end def fillDefaultData
|
#end def fillDefaultData
|
||||||
|
|
||||||
def rebuild_indexes(self, start=None):
|
def rebuild_indexes(self, start=None):
|
||||||
|
@ -1376,6 +1375,7 @@ class Database:
|
||||||
self.createAllIndexes()
|
self.createAllIndexes()
|
||||||
self.dropAllForeignKeys()
|
self.dropAllForeignKeys()
|
||||||
self.createAllForeignKeys()
|
self.createAllForeignKeys()
|
||||||
|
#end def rebuild_indexes
|
||||||
|
|
||||||
def rebuild_hudcache(self, h_start=None, v_start=None):
|
def rebuild_hudcache(self, h_start=None, v_start=None):
|
||||||
"""clears hudcache and rebuilds from the individual handsplayers records"""
|
"""clears hudcache and rebuilds from the individual handsplayers records"""
|
||||||
|
@ -1795,8 +1795,9 @@ class Database:
|
||||||
hilo = "s"
|
hilo = "s"
|
||||||
elif game['category'] in ['razz','27_3draw','badugi']:
|
elif game['category'] in ['razz','27_3draw','badugi']:
|
||||||
hilo = "l"
|
hilo = "l"
|
||||||
tmp = self.insertGameTypes( (siteid, game['type'], game['base'], game['category'], game['limitType'], hilo,
|
tmp = self.insertGameTypes( (siteid, 'USD', game['type'], game['base'], game['category'], game['limitType'], hilo,
|
||||||
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) )
|
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) )
|
||||||
|
#FIXME: recognise currency
|
||||||
return tmp[0]
|
return tmp[0]
|
||||||
|
|
||||||
def getSqlPlayerIDs(self, pnames, siteid):
|
def getSqlPlayerIDs(self, pnames, siteid):
|
||||||
|
|
|
@ -87,8 +87,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)")
|
re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)")
|
||||||
re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries")
|
re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries")
|
||||||
re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)")
|
re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)")
|
||||||
re_TourneyRebuyAmount = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_AMOUNT>[.,0-9]+)")
|
re_TourneyRebuyCost = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_COST>[.,0-9]+)")
|
||||||
re_TourneyAddOnAmount = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_AMOUNT>[.,0-9]+)")
|
re_TourneyAddOnCost = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_COST>[.,0-9]+)")
|
||||||
re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy")
|
re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy")
|
||||||
re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On")
|
re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On")
|
||||||
re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)")
|
re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)")
|
||||||
|
@ -96,7 +96,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)")
|
re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)")
|
||||||
re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)")
|
re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)")
|
||||||
re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)")
|
re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)")
|
||||||
re_TourneyCountKO = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
|
re_TourneyKoCount = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
|
||||||
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
|
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
|
||||||
|
|
||||||
re_TourneysPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
|
re_TourneysPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
|
||||||
|
@ -430,7 +430,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if m:
|
if m:
|
||||||
# info list should be 2 lines : Tourney infos & Finsihing postions with winnings
|
# info list should be 2 lines : Tourney infos & Finsihing postions with winnings
|
||||||
if (len(summaryInfoList) != 2 ):
|
if (len(summaryInfoList) != 2 ):
|
||||||
log.info("Too many 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 = Tourney.Tourney(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
|
||||||
|
@ -566,8 +566,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips,
|
dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips,
|
||||||
"ENTRIES" : self.re_TourneyEntries,
|
"ENTRIES" : self.re_TourneyEntries,
|
||||||
"PRIZEPOOL" : self.re_TourneyPrizePool,
|
"PRIZEPOOL" : self.re_TourneyPrizePool,
|
||||||
"REBUY_AMOUNT" : self.re_TourneyRebuyAmount,
|
"REBUY_COST" : self.re_TourneyRebuyCost,
|
||||||
"ADDON_AMOUNT" : self.re_TourneyAddOnAmount,
|
"ADDON_COST" : self.re_TourneyAddOnCost,
|
||||||
"REBUY_TOTAL" : self.re_TourneyRebuysTotal,
|
"REBUY_TOTAL" : self.re_TourneyRebuysTotal,
|
||||||
"ADDONS_TOTAL" : self.re_TourneyAddOnsTotal,
|
"ADDONS_TOTAL" : self.re_TourneyAddOnsTotal,
|
||||||
"REBUY_CHIPS" : self.re_TourneyRebuyChips,
|
"REBUY_CHIPS" : self.re_TourneyRebuyChips,
|
||||||
|
@ -580,8 +580,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
dictHolders = { "BUYINCHIPS" : "buyInChips",
|
dictHolders = { "BUYINCHIPS" : "buyInChips",
|
||||||
"ENTRIES" : "entries",
|
"ENTRIES" : "entries",
|
||||||
"PRIZEPOOL" : "prizepool",
|
"PRIZEPOOL" : "prizepool",
|
||||||
"REBUY_AMOUNT" : "rebuyAmount",
|
"REBUY_COST" : "rebuyCost",
|
||||||
"ADDON_AMOUNT" : "addOnAmount",
|
"ADDON_COST" : "addOnCost",
|
||||||
"REBUY_TOTAL" : "totalRebuyCount",
|
"REBUY_TOTAL" : "totalRebuyCount",
|
||||||
"ADDONS_TOTAL" : "totalAddOnCount",
|
"ADDONS_TOTAL" : "totalAddOnCount",
|
||||||
"REBUY_CHIPS" : "rebuyChips",
|
"REBUY_CHIPS" : "rebuyChips",
|
||||||
|
@ -607,37 +607,36 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['REBUY_COUNT'] is not None :
|
if mg['REBUY_COUNT'] is not None :
|
||||||
tourney.countRebuys.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } )
|
tourney.rebuyCounts.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } )
|
||||||
m = self.re_TourneyAddOnCount.search(tourneyText)
|
m = self.re_TourneyAddOnCount.search(tourneyText)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['ADDON_COUNT'] is not None :
|
if mg['ADDON_COUNT'] is not None :
|
||||||
tourney.countAddOns.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } )
|
tourney.addOnCounts.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } )
|
||||||
m = self.re_TourneyCountKO.search(tourneyText)
|
m = self.re_TourneyKoCount.search(tourneyText)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['COUNT_KO'] is not None :
|
if mg['COUNT_KO'] is not None :
|
||||||
tourney.countKO.update( { tourney.hero : Decimal(mg['COUNT_KO']) } )
|
tourney.koCounts.update( { tourney.hero : Decimal(mg['COUNT_KO']) } )
|
||||||
|
|
||||||
# Deal with money amounts
|
# Deal with money amounts
|
||||||
tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty))
|
tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty))
|
||||||
tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool))
|
tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool))
|
||||||
tourney.rebuyAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyAmount))
|
tourney.rebuyCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyCost))
|
||||||
tourney.addOnAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnAmount))
|
tourney.addOnCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnCost))
|
||||||
|
|
||||||
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
|
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
|
||||||
for p in tourney.players :
|
for p in tourney.players :
|
||||||
tourney.payinAmounts[p] = tourney.buyin + tourney.fee + (tourney.rebuyAmount * tourney.countRebuys[p]) + (tourney.addOnAmount * tourney.countAddOns[p])
|
tourney.payinAmounts[p] = tourney.buyin + tourney.fee + (tourney.rebuyCost * tourney.rebuyCounts[p]) + (tourney.addOnCost * tourney.addOnCounts[p])
|
||||||
#print " player %s : payinAmount = %d" %( p, tourney.payinAmounts[p])
|
#print " player %s : payinAmount = %d" %( p, tourney.payinAmounts[p])
|
||||||
if tourney.isKO :
|
if tourney.isKO :
|
||||||
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.countKO[p]))
|
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p]))
|
||||||
tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.countKO[p])
|
tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p])
|
||||||
#print "player %s : winnings %d" % (p, tourney.winnings[p])
|
#print "player %s : winnings %d" % (p, tourney.winnings[p])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print mg
|
#print mg
|
||||||
return True
|
return True
|
||||||
|
#end def determineTourneyType
|
||||||
|
|
||||||
def getPlayersPositionsAndWinnings(self, tourney):
|
def getPlayersPositionsAndWinnings(self, tourney):
|
||||||
playersText = tourney.summaryText[1]
|
playersText = tourney.summaryText[1]
|
||||||
|
@ -656,7 +655,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
else:
|
else:
|
||||||
winnings = "0"
|
winnings = "0"
|
||||||
|
|
||||||
tourney.addPlayer(rank, a.group('PNAME'), winnings, 0, 0, 0, 0)
|
tourney.addPlayer(rank, a.group('PNAME'), winnings, "USD", 0, 0, 0, 0) #TODO: make it store actual winnings currency
|
||||||
else:
|
else:
|
||||||
print "FullTilt: Player finishing stats unreadable : %s" % a
|
print "FullTilt: Player finishing stats unreadable : %s" % a
|
||||||
|
|
||||||
|
|
|
@ -360,21 +360,29 @@ class Sql:
|
||||||
|
|
||||||
if db_server == 'mysql':
|
if db_server == 'mysql':
|
||||||
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
||||||
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||||
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||||
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,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
buyInChips INT NOT NULL,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT False,
|
maxSeats INT NOT NULL DEFAULT -1,
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT False,
|
rebuy BOOLEAN NOT NULL DEFAULT False,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT False,
|
rebuyCost INT,
|
||||||
speed varchar(10),
|
rebuyChips INT,
|
||||||
headsUp BOOLEAN NOT NULL DEFAULT False,
|
addOn BOOLEAN NOT NULL DEFAULT False,
|
||||||
shootout BOOLEAN NOT NULL DEFAULT False,
|
addOnCost INT,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT False,
|
addOnChips INT,
|
||||||
sng BOOLEAN NOT NULL DEFAULT False
|
knockout BOOLEAN NOT NULL DEFAULT False,
|
||||||
)
|
koBounty INT,
|
||||||
|
speed varchar(10),
|
||||||
|
headsUp BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
shootout BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
matrix BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
sng BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
satellite BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
doubleOrNothing BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
guarantee INT)
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif db_server == 'postgresql':
|
elif db_server == 'postgresql':
|
||||||
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
||||||
|
@ -383,33 +391,49 @@ 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,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
maxSeats INT NOT NULL DEFAULT -1,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT False,
|
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT False,
|
rebuy BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
rebuyCost INT,
|
||||||
|
rebuyChips INT,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT False,
|
addOn BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
addOnCost INT,
|
||||||
|
addOnChips INT,
|
||||||
|
knockout BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
koBounty INT,
|
||||||
speed varchar(10),
|
speed varchar(10),
|
||||||
headsUp BOOLEAN NOT NULL DEFAULT False,
|
headsUp BOOLEAN NOT NULL DEFAULT False,
|
||||||
shootout BOOLEAN NOT NULL DEFAULT False,
|
shootout BOOLEAN NOT NULL DEFAULT False,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT False,
|
matrix BOOLEAN NOT NULL DEFAULT False,
|
||||||
sng BOOLEAN NOT NULL DEFAULT False
|
sng BOOLEAN NOT NULL DEFAULT False,
|
||||||
)"""
|
satellite BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
doubleOrNothing BOOLEAN NOT NULL DEFAULT False,
|
||||||
|
guarantee INT)"""
|
||||||
elif db_server == 'sqlite':
|
elif db_server == 'sqlite':
|
||||||
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
siteId INT NOT NULL,
|
siteId INT NOT NULL,
|
||||||
currency TEXT 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,
|
||||||
maxSeats INT NOT NULL DEFAULT -1,
|
maxSeats INT NOT NULL DEFAULT -1,
|
||||||
knockout BOOLEAN NOT NULL DEFAULT 0,
|
|
||||||
rebuy BOOLEAN NOT NULL DEFAULT 0,
|
rebuy BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
rebuyCost INT,
|
||||||
|
rebuyChips INT,
|
||||||
addOn BOOLEAN NOT NULL DEFAULT 0,
|
addOn BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
addOnCost INT,
|
||||||
|
addOnChips INT,
|
||||||
|
knockout BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
koBounty INT,
|
||||||
speed TEXT,
|
speed TEXT,
|
||||||
headsUp BOOLEAN NOT NULL DEFAULT 0,
|
headsUp BOOLEAN NOT NULL DEFAULT 0,
|
||||||
shootout BOOLEAN NOT NULL DEFAULT 0,
|
shootout BOOLEAN NOT NULL DEFAULT 0,
|
||||||
matrix BOOLEAN NOT NULL DEFAULT 0,
|
matrix BOOLEAN NOT NULL DEFAULT 0,
|
||||||
sng BOOLEAN NOT NULL DEFAULT 0
|
sng BOOLEAN NOT NULL DEFAULT 0,
|
||||||
)"""
|
satellite BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
doubleOrNothing BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
guarantee INT)"""
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Create Tourneys
|
# Create Tourneys
|
||||||
|
@ -3552,9 +3576,9 @@ class Sql:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.query['insertGameTypes'] = """INSERT INTO Gametypes
|
self.query['insertGameTypes'] = """INSERT INTO Gametypes
|
||||||
(siteId, type, base, category, limitType
|
(siteId, currency, type, base, category, limitType
|
||||||
,hiLo, smallBlind, bigBlind, smallBet, bigBet)
|
,hiLo, smallBlind, bigBlind, smallBet, bigBet)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
|
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
|
||||||
|
|
||||||
self.query['isAlreadyInDB'] = """SELECT id FROM Hands
|
self.query['isAlreadyInDB'] = """SELECT id FROM Hands
|
||||||
WHERE gametypeId=%s AND siteHandNo=%s
|
WHERE gametypeId=%s AND siteHandNo=%s
|
||||||
|
|
|
@ -74,22 +74,26 @@ class Tourney(object):
|
||||||
self.subTourneyFee = None
|
self.subTourneyFee = None
|
||||||
self.rebuyChips = 0
|
self.rebuyChips = 0
|
||||||
self.addOnChips = 0
|
self.addOnChips = 0
|
||||||
self.rebuyAmount = 0
|
self.rebuyCost = 0
|
||||||
self.addOnAmount = 0
|
self.addOnCost = 0
|
||||||
self.totalRebuyCount = 0
|
self.totalRebuyCount = 0
|
||||||
self.totalAddOnCount = 0
|
self.totalAddOnCount = 0
|
||||||
self.koBounty = 0
|
self.koBounty = 0
|
||||||
self.tourneyComment = None
|
self.tourneyComment = None
|
||||||
self.players = []
|
self.players = []
|
||||||
|
self.isSng = False
|
||||||
|
self.isSatellite = False
|
||||||
|
self.isDoubleOrNothing = False
|
||||||
|
self.guarantee = 0
|
||||||
|
|
||||||
# Collections indexed by player names
|
# Collections indexed by player names
|
||||||
self.finishPositions = {}
|
self.finishPositions = {}
|
||||||
self.winnings = {}
|
self.winnings = {}
|
||||||
self.winningsCurrency = {}
|
self.winningsCurrency = {}
|
||||||
self.payinAmounts = {}
|
self.payinAmounts = {}
|
||||||
self.countRebuys = {}
|
self.rebuyCounts = {}
|
||||||
self.countAddOns = {}
|
self.addOnCounts = {}
|
||||||
self.countKO = {}
|
self.koCounts = {}
|
||||||
|
|
||||||
# currency symbol for this summary
|
# currency symbol for this summary
|
||||||
self.sym = None
|
self.sym = None
|
||||||
|
@ -121,12 +125,16 @@ class Tourney(object):
|
||||||
("SUB TOURNEY FEE", self.subTourneyFee),
|
("SUB TOURNEY FEE", self.subTourneyFee),
|
||||||
("REBUY CHIPS", self.rebuyChips),
|
("REBUY CHIPS", self.rebuyChips),
|
||||||
("ADDON CHIPS", self.addOnChips),
|
("ADDON CHIPS", self.addOnChips),
|
||||||
("REBUY AMOUNT", self.rebuyAmount),
|
("REBUY COST", self.rebuyCost),
|
||||||
("ADDON AMOUNT", self.addOnAmount),
|
("ADDON COST", self.addOnCost),
|
||||||
("TOTAL REBUYS", self.totalRebuyCount),
|
("TOTAL REBUYS", self.totalRebuyCount),
|
||||||
("TOTAL ADDONS", self.totalAddOnCount),
|
("TOTAL ADDONS", self.totalAddOnCount),
|
||||||
("KO BOUNTY", self.koBounty),
|
("KO BOUNTY", self.koBounty),
|
||||||
("TOURNEY COMMENT", self.tourneyComment)
|
("TOURNEY COMMENT", self.tourneyComment),
|
||||||
|
("SNG", self.isSng),
|
||||||
|
("SATELLITE", self.isSatellite),
|
||||||
|
("DOUBLE OR NOTHING", self.isDoubleOrNothing),
|
||||||
|
("GUARANTEE", self.guarantee)
|
||||||
)
|
)
|
||||||
|
|
||||||
structs = ( ("GAMETYPE", self.gametype),
|
structs = ( ("GAMETYPE", self.gametype),
|
||||||
|
@ -134,9 +142,9 @@ class Tourney(object):
|
||||||
("PAYIN AMOUNTS", self.payinAmounts),
|
("PAYIN AMOUNTS", self.payinAmounts),
|
||||||
("POSITIONS", self.finishPositions),
|
("POSITIONS", self.finishPositions),
|
||||||
("WINNINGS", self.winnings),
|
("WINNINGS", self.winnings),
|
||||||
("COUNT REBUYS", self.countRebuys),
|
("COUNT REBUYS", self.rebuyCounts),
|
||||||
("COUNT ADDONS", self.countAddOns),
|
("COUNT ADDONS", self.addOnCounts),
|
||||||
("NB OF KO", self.countKO)
|
("NB OF KO", self.koCounts)
|
||||||
)
|
)
|
||||||
str = ''
|
str = ''
|
||||||
for (name, var) in vars:
|
for (name, var) in vars:
|
||||||
|
@ -199,11 +207,11 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
|
||||||
self.players.append(name)
|
self.players.append(name)
|
||||||
self.finishPositions.update( { name : Decimal(rank) } )
|
self.finishPositions.update( { name : Decimal(rank) } )
|
||||||
self.winnings.update( { name : Decimal(winnings) } )
|
self.winnings.update( { name : Decimal(winnings) } )
|
||||||
self.winningsCurrency.update( { name : String(winningsCurrency) } )
|
self.winningsCurrency.update( { name : winningsCurrency } )
|
||||||
self.payinAmounts.update( {name : Decimal(payinAmount) } )
|
self.payinAmounts.update( {name : Decimal(payinAmount) } )
|
||||||
self.countRebuys.update( {name: Decimal(rebuyCount) } )
|
self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
|
||||||
self.countAddOns.update( {name: Decimal(addOnCount) } )
|
self.addOnCounts.update( {name: Decimal(addOnCount) } )
|
||||||
self.countKO.update( {name : Decimal(koCount) } )
|
self.koCounts.update( {name : Decimal(koCount) } )
|
||||||
|
|
||||||
|
|
||||||
def incrementPlayerWinnings(self, name, additionnalWinnings):
|
def incrementPlayerWinnings(self, name, additionnalWinnings):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user