From 701a824ac674086fd1e675254ada6ec9274f1da7 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 04:28:51 +0100
Subject: [PATCH] git39 - started to reactivate tourney support - split
tourneys table in design and recreate code, but still need to update the code
---
docs/known-bugs-and-planned-features.txt | 1 -
docs/tabledesign.html | 58 +++++++++++++++++-------
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 14 ++++--
pyfpdb/fpdb_parse_logic.py | 12 ++---
pyfpdb/fpdb_save_to_db.py | 17 +++----
6 files changed, 62 insertions(+), 42 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 9fde4b0a..1304efe1 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -12,7 +12,6 @@ split install instructions into OS-specific and OS-independent section. expand r
expand instructions for profile file, again, the release-creator will cat it.
delete old mailing list and create fpdb-announce
finish updating filelist
-return sng support
update abbreviations.txt
fix up bg colours in tv
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 30cd86cc..8d9a31a9 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -617,30 +617,15 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
|
- siteId |
+ tourneyGametypeId |
smallint |
- References Sites.id |
+ References TourneyGametypes.id |
siteTourneyNo |
bigint |
|
-
- buyin |
- int |
- Buy-in in cents. Without rebuy/add-on |
-
-
- fee |
- int |
-
|
-
-
- knockout |
- int |
-
|
-
entries |
int |
@@ -668,6 +653,45 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
+Table TourneyGametypes
+
+
+ Field name |
+ Type |
+ Comment |
+
+
+ id |
+ int |
+
|
+
+
+ siteId |
+ smallint |
+ References Sites.id |
+
+
+ buyin |
+ int |
+ Buy-in in cents. Without rebuy/add-on |
+
+
+ fee |
+ int |
+
|
+
+
+ knockout |
+ int |
+
|
+
+
+ rebuyOrAddon |
+ boolean |
+ Whether rebuys or add-ons are possible |
+
+
+
Table TourneysPlayers
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index e8a6f822..b3fef587 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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+, git38")
+ self.window.set_title("Free Poker DB - version: alpha1+, git39")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 13e63568..f83c9dbb 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=38:
+ if settings[0]!=39:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -119,6 +119,7 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysGametypes;")
self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
self.cursor.execute("DROP TABLE IF EXISTS Players;")
@@ -204,13 +205,18 @@ class fpdb_db:
card5Value smallint,
card5Suit char(1))""")
- self.create_table("""Tourneys (
+ self.create_table("""TourneysGametypes (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
- siteTourneyNo BIGINT,
buyin INT,
fee INT,
knockout INT,
+ rebuyOrAddon BOOLEAN)""")
+
+ self.create_table("""Tourneys (
+ id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ tourneysGametypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneysGametypeId) REFERENCES TourneysGametypes(id),
+ siteTourneyNo BIGINT,
entries INT,
prizepool INT,
startTime DATETIME,
@@ -309,7 +315,7 @@ class fpdb_db:
position CHAR(1))""")
- self.cursor.execute("INSERT INTO Settings VALUES (38);")
+ self.cursor.execute("INSERT INTO Settings VALUES (39);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index c8efc2e2..d69eeae0 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -113,12 +113,10 @@ def mainParser(db, cursor, site, category, hand):
entries=-1
prizepool=-1
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
- result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee,
- knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
- siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
- startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes,
- actionTypes, actionAmounts, hudImportData)
+ result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
+ siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
@@ -126,9 +124,7 @@ def mainParser(db, cursor, site, category, hand):
actionTypes, actionAmounts, hudImportData)
else:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
- result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID,
- handStartTime, names, playerIDs, startCashes, positions, cardValues,
- cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
+ result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
index a8040cf3..a3c95733 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -37,10 +37,9 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
return site_hand_no
#end def ring_stud
-#stores a holdem/omaha hand into the database
-def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time,
- names, player_ids, start_cashes, positions, card_values, card_suits,
- board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData):
+def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData):
+ """stores a holdem/omaha hand into the database"""
+
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
@@ -64,13 +63,9 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
return site_hand_no
#end def ring_holdem_omaha
-def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
- tourney_start, payin_amounts, ranks, #end of tourney specific params
- site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
- start_cashes, positions, card_values, card_suits,
- board_values, board_suits, winnings, rakes,
- action_types, action_amounts, hudImportData):
-#stores a tourney stud/razz hand into the database
+def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start, payin_amounts, ranks, #end of tourney specific params
+ site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData):
+ """stores a tourney holdem/omaha hand into the database"""
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)