split TourneyTypes.rebuyOrAddon to rebuy and addOn

This commit is contained in:
steffen123 2010-06-22 22:27:10 +02:00
parent e0a42bab8e
commit 8a2f881b61
4 changed files with 32 additions and 23 deletions

View File

@ -152,7 +152,8 @@ class HandInternal(DerivedStats):
'speed': 'speed', 'speed': 'speed',
'maxSeats': 'maxseats', 'maxSeats': 'maxseats',
'knockout': 'isKO', 'knockout': 'isKO',
'rebuyOrAddon': 'isRebuy', 'rebuy': 'isRebuy',
'addOn': 'isAddOn',
'headsUp': 'isHU', 'headsUp': 'isHU',
'shootout': 'isShootout', 'shootout': 'isShootout',
'matrix': 'isMatrix', 'matrix': 'isMatrix',
@ -382,7 +383,7 @@ class TourneyType(MappedBase):
Required kwargs: Required kwargs:
buyin fee speed maxSeats knockout buyin fee speed maxSeats knockout
rebuyOrAddon headsUp shootout matrix sng currency rebuy addOn headsUp shootout matrix sng currency
""" """
return get_or_create(cls, session, **kwargs)[0] return get_or_create(cls, session, **kwargs)[0]

View File

@ -374,7 +374,8 @@ tourney_types_table = Table('TourneyTypes', metadata,
Column('fee', Integer, nullable=False, default=0), # INT NOT NULL Column('fee', Integer, nullable=False, default=0), # 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('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('rebuyOrAddon', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
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
@ -385,9 +386,9 @@ tourney_types_table = Table('TourneyTypes', metadata,
) )
Index('tourneyTypes_all', Index('tourneyTypes_all',
tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee, tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee,
tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuyOrAddon, tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuy,
tourney_types_table.c.speed, tourney_types_table.c.headsUp, tourney_types_table.c.shootout, tourney_types_table.c.addOn, tourney_types_table.c.speed, tourney_types_table.c.headsUp,
tourney_types_table.c.matrix, tourney_types_table.c.sng) tourney_types_table.c.shootout, tourney_types_table.c.matrix, tourney_types_table.c.sng)
tourneys_players_table = Table('TourneysPlayers', metadata, tourneys_players_table = Table('TourneysPlayers', metadata,

View File

@ -75,7 +75,7 @@ except ImportError:
use_numpy = False use_numpy = False
DB_VERSION = 119 DB_VERSION = 120
# Variance created as sqlite has a bunch of undefined aggregate functions. # Variance created as sqlite has a bunch of undefined aggregate functions.
@ -1357,15 +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) VALUES (NULL, 1, 0, 0);") c.execute("""INSERT INTO TourneyTypes (id, siteId, buyin, fee, maxSeats, knockout
,rebuy, addOn, speed, headsUp, shootout, matrix)
VALUES (NULL, 1, 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, buyin, fee, maxSeats, knockout
,rebuyOrAddon, speed, headsUp, shootout, matrix) ,rebuy, addOn, speed, headsUp, shootout, matrix)
values (1, 0, 0, 0, False, False, null, False, False, False);""") values (1, 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, buyin, fee, maxSeats, knockout
,rebuyOrAddon, speed, headsUp, shootout, matrix) ,rebuy, addOn, speed, headsUp, shootout, matrix)
values (DEFAULT, 1, 0, 0, 0, False, False, null, False, False, False);""") values (DEFAULT, 1, 0, 0, 0, False, False, False, null, False, False, False);""")
#end def fillDefaultData #end def fillDefaultData

View File

@ -367,7 +367,8 @@ class Sql:
fee INT NOT NULL, fee INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, maxSeats INT NOT NULL DEFAULT -1,
knockout BOOLEAN NOT NULL DEFAULT False, knockout BOOLEAN NOT NULL DEFAULT False,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, rebuy BOOLEAN NOT NULL DEFAULT False,
addOn BOOLEAN NOT NULL DEFAULT False,
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,
@ -384,7 +385,8 @@ class Sql:
fee INT NOT NULL, fee INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, maxSeats INT NOT NULL DEFAULT -1,
knockout BOOLEAN NOT NULL DEFAULT False, knockout BOOLEAN NOT NULL DEFAULT False,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, rebuy BOOLEAN NOT NULL DEFAULT False,
addOn BOOLEAN NOT NULL DEFAULT False,
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,
@ -400,7 +402,8 @@ class Sql:
fee INT NOT NULL, fee INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, maxSeats INT NOT NULL DEFAULT -1,
knockout BOOLEAN NOT NULL DEFAULT 0, knockout BOOLEAN NOT NULL DEFAULT 0,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT 0, rebuy BOOLEAN NOT NULL DEFAULT 0,
addOn BOOLEAN NOT NULL DEFAULT 0,
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,
@ -1239,13 +1242,13 @@ class Sql:
if db_server == 'mysql': if db_server == 'mysql':
self.query['addTTypesIndex'] = """ALTER TABLE TourneyTypes ADD UNIQUE INDEX tourneytypes_all(buyin, fee self.query['addTTypesIndex'] = """ALTER TABLE TourneyTypes ADD UNIQUE INDEX tourneytypes_all(buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)"""
self.query['get_last_hand'] = "select max(id) from Hands" self.query['get_last_hand'] = "select max(id) from Hands"
@ -3562,7 +3565,8 @@ class Sql:
tt.fee, tt.fee,
tt.maxSeats, tt.maxSeats,
tt.knockout, tt.knockout,
tt.rebuyOrAddon, tt.rebuy,
tt.addOn,
tt.speed, tt.speed,
tt.headsUp, tt.headsUp,
tt.shootout, tt.shootout,
@ -3578,7 +3582,8 @@ class Sql:
AND buyin=%s AND buyin=%s
AND fee=%s AND fee=%s
AND knockout=%s AND knockout=%s
AND rebuyOrAddon=%s AND rebuy=%s
AND addOn=%s
AND speed=%s AND speed=%s
AND headsUp=%s AND headsUp=%s
AND shootout=%s AND shootout=%s
@ -3586,9 +3591,9 @@ class Sql:
""" """
self.query['insertTourneyTypes'] = """INSERT INTO TourneyTypes self.query['insertTourneyTypes'] = """INSERT INTO TourneyTypes
(siteId, buyin, fee, knockout, rebuyOrAddon (siteId, buyin, fee, knockout, rebuy, addOn
,speed, headsUp, shootout, matrix) ,speed, headsUp, shootout, matrix)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
""" """
self.query['getTourney'] = """SELECT t.id, self.query['getTourney'] = """SELECT t.id,
@ -3624,7 +3629,7 @@ class Sql:
tourneyName = %s, tourneyName = %s,
matrixIdProcessed = %s, matrixIdProcessed = %s,
totalRebuyCount = %s, totalRebuyCount = %s,
totalAddonCount = %s, totalAddOnCount = %s,
comment = %s, comment = %s,
commentTs = %s commentTs = %s
WHERE id=%s WHERE id=%s