p43 - implemented gametypes.base/.hiLo and more updates to table design

This commit is contained in:
steffen123
2008-08-17 02:46:23 +01:00
parent e9d8b685ec
commit 9531c8d85b
5 changed files with 51 additions and 19 deletions
+1 -1
View File
@@ -370,7 +370,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, p42")
self.window.set_title("Free Poker DB - version: alpha1+, p43")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
+13 -8
View File
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
if settings[0]!=41:
if settings[0]!=43:
print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -159,8 +159,10 @@ class fpdb_db:
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4),
base char(4),
category varchar(9),
limitType char(2),
hiLo char(1),
smallBlind int,
bigBlind int,
smallBet int,
@@ -184,11 +186,13 @@ class fpdb_db:
self.create_table("""Hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteHandNo bigint,
tableName VARCHAR(20),
siteHandNo BIGINT,
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
handStart DATETIME,
seats smallint,
comment text,
importTime DATETIME,
seats SMALLINT,
comment TEXT,
commentTs DATETIME)""")
self.create_table("""BoardCards (
@@ -237,9 +241,10 @@ class fpdb_db:
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
startCash int,
position char(1),
ante int,
startCash INT,
position CHAR(1),
seatNo SMALLINT,
ante INT,
card1Value smallint,
card1Suit char(1),
@@ -332,7 +337,7 @@ class fpdb_db:
riverCheckCallRaiseChance INT,
riverCheckCallRaiseDone INT)""")
self.cursor.execute("INSERT INTO Settings VALUES (41);")
self.cursor.execute("INSERT INTO Settings VALUES (43);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.cursor.execute("INSERT INTO TourneysGametypes (id) VALUES (DEFAULT);")
+13 -4
View File
@@ -967,22 +967,31 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
try:
len(result)
except TypeError:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
if category=="holdem" or category=="omahahi" or category=="omahahilo":
max_seats=10
base="hold"
else:
max_seats=8
base="stud"
if category=="holdem" or category=="omahahi" or category=="studhi":
hiLo='h'
elif category=="razz":
hiLo='l'
else:
hiLo='s'
if (limit_type=="fl"):
big_blind=small_bet #todo: read this
small_blind=big_blind/2 #todo: read this
cursor.execute("""INSERT INTO Gametypes
(siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet))
(siteId, type, base, category, limitType, hiLo, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, base, category, limit_type, hiLo, small_blind, big_blind, small_bet, big_bet))
cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else:
cursor.execute("""INSERT INTO Gametypes
(siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, base, category, limit_type, hiLo, small_bet, big_bet, 0, 0))#remember, for these bet means blind
cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone()