From b772ba49ce5cc918537a5fb30d94c6fd0fdc8fa9 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 27 Dec 2009 03:04:23 +0000 Subject: [PATCH 001/425] raise fpdbparseerror on a bug --- pyfpdb/Hand.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 3467216a..1bdfe250 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -480,8 +480,6 @@ Card ranks will be uppercased self.totalcollected += Decimal(entry[1]) - - def getGameTypeAsString(self): """\ Map the tuple self.gametype onto the pokerstars string describing it @@ -1406,6 +1404,8 @@ class Pot(object): # Return any uncalled bet. committed = sorted([ (v,k) for (k,v) in self.committed.items()]) + if len(committed)<2: + raise FpdbParseError("length of committed array is too small") lastbet = committed[-1][0] - committed[-2][0] if lastbet > 0: # uncalled returnto = committed[-1][1] From 72730291f01967118bdcfde7146e890e5de481e8 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 27 Feb 2010 09:35:18 +0200 Subject: [PATCH 002/425] Fix HUD-cache updates on Postgres The value in pdata[p]['position'] is a string. Change the 'pos' dictionary keys to strings, and to prevent potential breakage on other databases, always enforce that the looked up key is first converted to string. --- pyfpdb/Database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 0303aad2..069789f3 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1703,8 +1703,8 @@ class Database: line[55] = gid # gametypeId line[56] = pids[p] # playerId line[57] = len(pids) # activeSeats - pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' } - line[58] = pos[pdata[p]['position']] + pos = {'B':'B', 'S':'S', '0':'D', '1':'C', '2':'M', '3':'M', '4':'M', '5':'E', '6':'E', '7':'E', '8':'E', '9':'E' } + line[58] = pos[str(pdata[p]['position'])] line[59] = pdata[p]['tourneyTypeId'] line[60] = styleKey # styleKey inserts.append(line) From 4042fc6c40b9cd4f03f0be9ae9e854662ba114f1 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 27 Feb 2010 17:41:52 +0200 Subject: [PATCH 003/425] Use sqlcoder's fix for position map The values for pdata[p]['position'] come from DerivedStats.py, where the value was explicitly cast to a string. This way it should work again and use the cleaner code from sqlcoder instead. --- pyfpdb/Database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f24a7c33..d0fe733b 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1713,8 +1713,8 @@ class Database: line[55] = gid # gametypeId line[56] = pids[p] # playerId line[57] = len(pids) # activeSeats - pos = {'B':'B', 'S':'S', '0':'D', '1':'C', '2':'M', '3':'M', '4':'M', '5':'E', '6':'E', '7':'E', '8':'E', '9':'E' } - line[58] = pos[str(pdata[p]['position'])] + pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' } + line[58] = pos[pdata[p]['position']] line[59] = pdata[p]['tourneyTypeId'] line[60] = styleKey # styleKey inserts.append(line) From dcbb90def66c59daa10631e0a0e74949689968fa Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Fri, 5 Mar 2010 08:39:54 +0200 Subject: [PATCH 004/425] Update changelog and bump version --- packaging/debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 4bacf635..ebd45a53 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,10 @@ +free-poker-tools (0.20~git20100305) unstable; urgency=low + + * New snapshot + * Version bumped to 0.20 + + -- Mika Bostrom Fri, 05 Mar 2010 08:38:52 +0200 + free-poker-tools (0.12~git20100122) unstable; urgency=low * New snapshot release with reworked import code From 014ddedc013dcb449596c2475b5744f664013291 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 7 Mar 2010 10:30:56 +0000 Subject: [PATCH 005/425] create db automatically if using sqlite --- pyfpdb/Database.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f51ce5f5..8939d4b3 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -382,6 +382,7 @@ class Database: print msg raise FpdbError(msg) elif backend == Database.SQLITE: + create = True import sqlite3 if use_pool: sqlite3 = pool.manage(sqlite3, pool_size=1) From 2e83e91ba53802c2a59a93c162d159df51778212 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 8 Mar 2010 22:31:07 +0000 Subject: [PATCH 006/425] add having clause to sqlite version of guistats query --- pyfpdb/SQL.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 51863698..b6eb8ee0 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2099,6 +2099,7 @@ class Sql: ,plposition ,upper(gt.limitType) ,s.name + having 1 = 1 order by hp.playerId ,gt.base ,gt.category From 04acf25416e4f87e680eb38dce9efeba2fe8974d Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 8 Mar 2010 22:32:09 +0000 Subject: [PATCH 007/425] don't display headings for bottom table when it can't be calculated --- pyfpdb/GuiPlayerStats.py | 41 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index 3c3f46e3..a4bbdef1 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -208,6 +208,7 @@ class GuiPlayerStats (threading.Thread): def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates, games): starttime = time() + show_detail = True # Scrolled window for summary table swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None) @@ -224,25 +225,30 @@ class GuiPlayerStats (threading.Thread): self.addGrid(swin, 'playerDetailedStats', flags, playerids ,sitenos, limits, type, seats, groups, dates, games) - # Separator - vbox2 = gtk.VBox(False, 0) - heading = gtk.Label(self.filterText['handhead']) - heading.show() - vbox2.pack_start(heading, expand=False, padding=3) + if 'allplayers' in groups and groups['allplayers']: + # can't currently do this combination so skip detailed table + show_detail = False - # Scrolled window for detailed table (display by hand) - swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None) - swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - swin.show() - vbox2.pack_start(swin, expand=True, padding=3) - vbox.pack2(vbox2) - vbox2.show() + if show_detail: + # Separator + vbox2 = gtk.VBox(False, 0) + heading = gtk.Label(self.filterText['handhead']) + heading.show() + vbox2.pack_start(heading, expand=False, padding=3) - # Detailed table - flags[0] = True - flags[2] = 1 - self.addGrid(swin, 'playerDetailedStats', flags, playerids - ,sitenos, limits, type, seats, groups, dates, games) + # Scrolled window for detailed table (display by hand) + swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None) + swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + swin.show() + vbox2.pack_start(swin, expand=True, padding=3) + vbox.pack2(vbox2) + vbox2.show() + + # Detailed table + flags[0] = True + flags[2] = 1 + self.addGrid(swin, 'playerDetailedStats', flags, playerids + ,sitenos, limits, type, seats, groups, dates, games) self.db.rollback() print "Stats page displayed in %4.2f seconds" % (time() - starttime) @@ -421,6 +427,7 @@ class GuiPlayerStats (threading.Thread): else: treerow.append(' ') iter = self.liststore[grid].append(treerow) + #print treerow sqlrow += 1 row += 1 vbox.show_all() From 6117eb64c8f30883bb0ca6d192b539157a497429 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 8 Mar 2010 22:47:44 +0000 Subject: [PATCH 008/425] remember separator position when refresh is clicked --- pyfpdb/GuiPlayerStats.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index a4bbdef1..30bef936 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -142,7 +142,7 @@ class GuiPlayerStats (threading.Thread): self.stats_frame = gtk.Frame() self.stats_frame.show() - self.stats_vbox = gtk.VBox(False, 0) + self.stats_vbox = gtk.VPaned() self.stats_vbox.show() self.stats_frame.add(self.stats_vbox) # self.fillStatsFrame(self.stats_vbox) @@ -155,12 +155,15 @@ class GuiPlayerStats (threading.Thread): # make sure Hand column is not displayed [x for x in self.columns if x[0] == 'hand'][0][1] = False + self.last_pos = -1 + def get_vbox(self): """returns the vbox of this thread""" return self.main_hbox def refreshStats(self, widget, data): + self.last_pos = self.stats_vbox.get_position() try: self.stats_vbox.destroy() except AttributeError: pass self.liststore = [] @@ -170,6 +173,8 @@ class GuiPlayerStats (threading.Thread): self.stats_vbox.show() self.stats_frame.add(self.stats_vbox) self.fillStatsFrame(self.stats_vbox) + if self.last_pos > 0: + self.stats_vbox.set_position(self.last_pos) def fillStatsFrame(self, vbox): sites = self.filters.getSites() From a10f7c144ea8aa302cc73437b5126f3dce7220ef Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 9 Mar 2010 22:36:03 +0000 Subject: [PATCH 009/425] allow log viewer to view all 4 log/error files --- pyfpdb/GuiLogView.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/pyfpdb/GuiLogView.py b/pyfpdb/GuiLogView.py index 9dcb9588..755e1762 100755 --- a/pyfpdb/GuiLogView.py +++ b/pyfpdb/GuiLogView.py @@ -33,6 +33,11 @@ log = logging.getLogger("logview") MAX_LINES = 100000 # max lines to display in window EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file +LOGFILES = [ [ 'Fpdb Errors', 'fpdb-errors.txt', False ] # label, filename, start value + , [ 'Fpdb Log', 'fpdb-log.txt', True ] + , [ 'HUD Errors', 'HUD-errors.txt', False ] + , [ 'HUD Log', 'HUD-log.txt', False ] + ] class GuiLogView: @@ -41,7 +46,7 @@ class GuiLogView: self.main_window = mainwin self.closeq = closeq - self.logfile = self.config.log_file # name of logfile + self.logfile = os.path.join(self.config.dir_log, LOGFILES[1][1]) self.dia = gtk.Dialog(title="Log Messages" ,parent=None ,flags=gtk.DIALOG_DESTROY_WITH_PARENT @@ -69,10 +74,19 @@ class GuiLogView: scrolledwindow.add(self.listview) self.vbox.pack_start(scrolledwindow, expand=True, fill=True, padding=0) + hb = gtk.HBox(False, 0) + grp = None + for logf in LOGFILES: + rb = gtk.RadioButton(group=grp, label=logf[0], use_underline=True) + if grp is None: grp = rb + rb.set_active(logf[2]) + rb.connect('clicked', self.__set_logfile, logf[0]) + hb.pack_start(rb, False, False, 3) refreshbutton = gtk.Button("Refresh") refreshbutton.connect("clicked", self.refresh, None) - self.vbox.pack_start(refreshbutton, False, False, 3) + hb.pack_start(refreshbutton, False, False, 3) refreshbutton.show() + self.vbox.pack_start(hb, False, False, 0) self.listview.show() scrolledwindow.show() @@ -90,6 +104,14 @@ class GuiLogView: self.dia.connect('response', self.dialog_response_cb) + def __set_logfile(self, w, file): + #print "w is", w, "file is", file, "active is", w.get_active() + if w.get_active(): + for logf in LOGFILES: + if logf[0] == file: + self.logfile = os.path.join(self.config.dir_log, logf[1]) + self.refresh(w, file) # params are not used + def dialog_response_cb(self, dialog, response_id): # this is called whether close button is pressed or window is closed self.closeq.put(self.__class__) @@ -131,11 +153,14 @@ class GuiLogView: l = 0 for line in open(self.logfile): - # eg line: + # example line in logfile format: # 2009-12-02 15:23:21,716 - config DEBUG config logger initialised l = l + 1 - if l > startline and len(line) > 49: - iter = self.liststore.append( (line[0:23], line[26:32], line[39:46], line[48:].strip(), True) ) + if l > startline: + if len(line) > 49 and line[23:26] == ' - ' and line[34:39] == ' ': + iter = self.liststore.append( (line[0:23], line[26:32], line[39:46], line[48:].strip(), True) ) + else: + iter = self.liststore.append( ('', '', '', line.strip(), True) ) def sortCols(self, col, n): try: From a4a4eaa87bb4e95604419e7ed4ca633e65f1a9c4 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 15 Mar 2010 21:48:25 +0000 Subject: [PATCH 010/425] add general section to configuration. currently includes default bulk import path and start of day offset --- pyfpdb/Configuration.py | 26 ++++++++++++++++++++++++++ pyfpdb/Filters.py | 19 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index d0f81a1b..47a7786a 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -452,6 +452,24 @@ class Tv: return (" combinedStealFold = %s\n combined2B3B = %s\n combinedPostflop = %s\n" % (self.combinedStealFold, self.combined2B3B, self.combinedPostflop) ) +class General(dict): + def __init__(self): + super(General, self).__init__() + + def add_elements(self, node): + # HH_bulk_path - if set, used as default path for bulk imports: + # day_start - number n where 0.0 <= n < 24.0 representing start of day for user + # e.g. user could set to 4.0 for day to start at 4am local time + for (name, value) in node.attributes.items(): + log.debug("config.general: adding %s = %s" % (name,value)) + self[name] = value + + def __str__(self): + s = "" + for k in self: + s = s + " %s = %s\n" % (k, self[k]) + return(s) + class Config: def __init__(self, file = None, dbname = ''): # "file" is a path to an xml file with the fpdb/HUD configuration @@ -506,7 +524,10 @@ class Config: self.popup_windows = {} self.db_selected = None # database the user would like to use self.tv = None + self.general = General() + for gen_node in doc.getElementsByTagName("general"): + self.general.add_elements(node=gen_node) # add/overwrite elements in self.general # s_sites = doc.getElementsByTagName("supported_sites") for site_node in doc.getElementsByTagName("site"): @@ -839,6 +860,8 @@ class Config: path = os.path.expanduser(self.supported_sites[site].HH_path) assert(os.path.isdir(path) or os.path.isfile(path)) # maybe it should try another site? paths['hud-defaultPath'] = paths['bulkImport-defaultPath'] = path + if 'HH_bulk_path' in self.general and self.general['HH_bulk_path']: + paths['bulkImport-defaultPath'] = self.general['HH_bulk_path'] except AssertionError: paths['hud-defaultPath'] = paths['bulkImport-defaultPath'] = "** ERROR DEFAULT PATH IN CONFIG DOES NOT EXIST **" return paths @@ -987,6 +1010,9 @@ class Config: """Join the fpdb path to filename.""" return os.path.join(os.path.dirname(inspect.getfile(sys._getframe(0))), filename) + def get_general_params(self): + return( self.general ) + if __name__== "__main__": c = Config() diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index c8e8e219..4603e6e4 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -58,6 +58,11 @@ class Filters(threading.Thread): ,'limitsFL':'FL', 'limitsNL':'NL', 'limitsPL':'PL', 'ring':'Ring', 'tour':'Tourney' } + gen = self.conf.get_general_params() + self.day_start = 0 + if 'day_start' in gen: + self.day_start = float(gen['day_start']) + # Outer Packing box self.mainVBox = gtk.VBox(False, 0) @@ -864,6 +869,9 @@ class Filters(threading.Thread): self.end_date.set_text('') def __get_dates(self): + # self.day_start gives user's start of day in hours + offset = int(self.day_start * 3600) # calc day_start in seconds + t1 = self.start_date.get_text() t2 = self.end_date.get_text() @@ -872,10 +880,19 @@ class Filters(threading.Thread): if t2 == '': t2 = '2020-12-12' + s1 = strptime(t1, "%Y-%m-%d") # make time_struct + s2 = strptime(t2, "%Y-%m-%d") + e1 = mktime(s1) + offset # s1 is localtime, but returned time since epoch is UTC, then add the + e2 = mktime(s2) + offset # s2 is localtime, but returned time since epoch is UTC + + adj_t1 = strftime("%Y-%m-%d %H:%M:%S", gmtime(e1)) # make adjusted string including time + adj_t1 = strftime("%Y-%m-%d %H:%M:%S", gmtime(e1)) + log.info("t1="+t1+" adj_t1="+adj_t1+'.') + return (t1, t2) def __get_date(self, widget, calendar, entry, win): -# year and day are correct, month is 0..11 + # year and day are correct, month is 0..11 (year, month, day) = calendar.get_date() month += 1 ds = '%04d-%02d-%02d' % (year, month, day) From ef36e260e5e207086e8c6ad49b538ee742907aa6 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 15 Mar 2010 21:51:39 +0000 Subject: [PATCH 011/425] prepare for change to store time in UTC --- pyfpdb/PokerStarsToFpdb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 87574e9d..1771f925 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -82,6 +82,7 @@ class PokerStars(HandHistoryConverter): # self.re_setHandInfoRegex('.*#(?P[0-9]+): Table (?P[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P
- - - - - - - - - - -

Field name

Type

Comment

version

smallint

the git version of the database (ie. table design changes and major bugfixes require a bump)

-

Table Players

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

int


name

varchar(32)


siteId

smallint

references Sites.id

comment

text


commentTs

datetime (in UTC)


-


-

Table Autorates

-

An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

bigint


playerId

int

references Players.id

gametypeId

smallint

references Gametypes.id

description

varchar(50)

autorating description

shortDesc

char(8)

short description e.g. for display in HUD

ratingTime

datetime (in UTC)

timestamp of rating

handCount

int

number of hands rating is based on

-


-

Table Gametypes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

smallint


siteId

smallint

references sites.id

type

char(4)

valid entries:
- ring - ringgames aka cash games
- tour - tournament incl SnG

base

char(4)

The underlying structure. valid entries:
- hold - Holdem and Omaha
- stud - Stud and Razz
- draw - (incl Badugi)

category

varchar(9)

valid entries:
- holdem=Texas Hold'em
- omahahi=Omaha High only
- omahahilo=Omaha 8 or better
- razz=Razz
- studhi=7 Card Stud High only
- studhilo=7 Card Stud 8 or better
- fivedraw=Five Card Draw
- 27_1draw=2-7 Single Draw
- 27_3draw=2-7 Tripple Draw
- badugi=Badugi

limitType

char(2)

nl=No Limit
- cn=Cap No Limit
- pl=Pot Limit
- cp=Cap Pot Limit
- fl=Fixed Limit

hiLo

char(1)

Whether the game is hi, lo or both. Valid Entries:
- h - High only
- l - Low only
- s - Hi/Lo Split

smallBlind

int


bigBlind

int


smallBet

int


bigBet

int


-


-

Table Sites

- - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

smallint


name

varchar(32)


currency

char(3)

currency code, e.g. USD, GBP, EUR

-


-

Table Hands

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


tableName

varchar(20)

The site's name for the current table

siteHandNo

bigint

the site's hand number

gametypeId

smallint

references gametypes.id

handStart

datetime (in UTC)

start date&time of the hand

importTime

datetime (in UTC)

date&time of import of this hand

seats

smallint

number of used seats (ie. that got dealt cards)

maxSeats

smallint

number of available seats

comment

text


commentTs

datetime (in UTC)


-


-

Table BoardCards

-

cardX -> can be 1 through 5

- - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


handId

bigint

the site's hand number

cardXValue

smallint

2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x, kept=k (draw only)

cardXSuit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x

-


-

Table HandsPlayers

-

cardX: can be 1 through 20, one for each card. In holdem only 1-2 of these are used, in omaha 1-4, in stud/razz 1-7, in single draw games 1-10 is used and in badugi 1-16 (4*4) is used.

-

For the draw games: the first 5 (badugi: 4) cards are the initial cards, the next 5 (badugi: 4) are after the first draw. If a player keeps some cards then those cards' spaces are filled with "k", short for "kept".
-Example 1: If a player gets 2-6 spades for his first five cards and decides to throw away the 4 and then gets a 7 of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 4, 5, 6, k, k, 7, k, k
-Example 2: If a player gets 2, 3, 5, 8, J of spades for his first five cards and decides to throw away the 2 and the 3 and then gets a Q and K of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 5, 8, J, Q, K, k, k, k
-Note that it will k in the space of which card was there previously, so in example 2 where the player kept the last 3 cards, the last 3 fields of the first draw (ie. card8-10Value) are replaced with k.

-

I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.

-

ToDo: Original plan was to implement the many flags from hudcache as booleans - need to try this out as it will save space and may therefore be quicker.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

-

Comment

id

bigint


handId

bigint

references Hands.id

playerId

int

references Players.id

startCash

int


position

char(1)

BB=B, SB=S, Button=0, Cutoff=1, etc.
- This is used in holdem/omaha only.

seatNo

smallint

The seat in which the person was sitting - necessary for HUD

card1(..7)

smallint

0=none/unknown, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As

startCards

smallint

int representing Holdem starting cards.
Hand is stored as an int 13 * x + y where x and y -are in range 0..12, and (x+2) and (y+2) represents rank of each card (2=2 .. 14=Ace).
-If x > y then pair is suited, if x < y then unsuited.
-Omaha and other games may need to use this as a key into another table. (to be decided ...)

ante

int

note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante

winnings

int

winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)

rake

int

rake for this player for this hand (i.e. final pot(s) size = winnings + rake)

totalProfit

int

profit for this player for this hand ( i.e. winnings - (ante + bets) )

comment

text


commentTs

datetime (in UTC)


tourneysPlayersId

bigint

references TourneysPlayers.id

tourneyTypeId

bigint

references TourneyTypes.id (maybe this should be on Hands?)

wonWhenSeenStreet1(..4)

float

How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (2/3/4: Same for turn/street5, river/street6, street7)

wonAtSD

float

As wonWhenSeenStreet1, but for showdown.

street0VPI

int

did player pay to see flop, 1 or 0

street0Aggr

int

did player raise before flop, 1 or 0

street0_3BChance

int

did player have chance to 3B, 1 or 0

street0_3BDone

int

did player 3bet before flop, 1 or 0

street0_4BChance

int

did player have chance to 4B, 1 or 0

street0_4BDone

int

did player 4bet before flop, 1 or 0

other_3BStreet0

int

did other player 3bet before flop, 1 or 0

other_4BStreet0

int

did other player 4bet before flop, 1 or 0

street1Seen(/2/3/4)

int

did player see flop/street4 (.. etc)

sawShowdown

int

did player see showdown

street1Aggr

int

number of hands where player raised flop/street4

street2Aggr

int

number of hands where player raised turn/street5

street3Aggr

int

number of hands where player raised river/street6

street4Aggr

int

number of hands where player raised street7

otherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3

otherRaisedStreet1

int

number of hands where someone else raised flop/street4

otherRaisedStreet2

int

number of hands where someone else raised turn/street5

otherRaisedStreet3

int

number of hands where someone else raised river/street6

otherRaisedStreet4

int

number of hands where someone else raised street7

foldToOtherRaisedStreet0

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet1

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet2

int

number of hands where someone else raised Turn/street5 and the player folded

foldToOtherRaisedStreet3

int

number of hands where someone else raised River/street6 and the player folded

foldToOtherRaisedStreet4

int

number of hands where someone else raised street7 and the player folded

stealAttemptChance

int

Player was in CO, BTN or SB and nobody has called yet

stealAttempted

int

Player took a chance per the above condition

foldBbToStealChance

int

Somebody tried to steal BB from player

foldedBbToSteal

int

Player folded BB to steal attempt

foldSbToStealChance

int

Somebody tried to steal SB from player

foldedSbToSteal

int

Player folded SB to steal attempt

street1CBChance

int

Player had chance to make continuation bet on flop/street4

street1CBDone

int

Player used chance to make continuation bet on flop/street4

street2CBChance

int

Player had chance to make continuation bet on turn/street5

street2CBDone

int

Player used chance to make continuation bet on turn/street5

street3CBChance

int

Player had chance to make continuation bet on river/street6

street3CBDone

int

Player used chance to make continuation bet on river/street6

street4CBChance

int

Player had chance to make continuation bet on street7

street4CBDone

int

Player used chance to make continuation bet on street7

foldToStreet1CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet1CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet2CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet2CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet3CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet3CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet4CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet4CBDone

int

Player used chance to fold to continuation bet on this street

street1CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street1CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street0Calls

int

Number of times player called on this street

street1Calls

int

Number of times player called on this street

street2Calls

int

Number of times player called on this street

street3Calls

int

Number of times player called on this street

street4Calls

int

Number of times player called on this street

street0Bets

int

Number of times player bet on this street

street1Bets

int

Number of times player bet on this street

street2Bets

int

Number of times player bet on this street

street3Bets

int

Number of times player bet on this street

street4Bets

int

Number of times player bet on this street

street0Raises

int

Number of times player raised on this street

street1Raises

int

Number of times player raised on this street

street2Raises

int

Number of times player raised on this street

street3Raises

int

Number of times player raised on this street

street4Raises

int

Number of times player raised on this street

actionString

int

Experimental - idea is to store the action on this street as a string: e.g. kkBrcfC, with - player's own choices in upper case and other players in lower case. k=check, b=bet, c=call, - r=raise. (Perhaps NL would miss out bet sizes for this?) It would then be possible to do complex - ad-hoc queries using queries like: actionString like '%B%r%C% -

-


-

Table HudCache

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


gametypeId

smallint

references gametypes.id

playerId

int

references players.id

activeSeats

smallint

range 2-10

position

char(1)

Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle)

tourneyTypeId

smallint

References TourneyTypes.id

HDs

int

number of hands this player played in this gametype with this number of seats

wonWhenSeenStreet1(/2/3/4)

float

How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (/2/3/4: Same for turn/street5, river/street6, street7)

wonAtSD

float

As wonWhenSeenStreet1, but for showdown.

street0VPI

int

number of hands where player paid to see flop
- Please note that this already includes street0Aggr!
- To calculate limp just deduct street0Aggr from this number

street0Aggr

int

number of hands where player raised before flop

street0_3BChance

int

number of hands where player had chance to 3B before flop

street0_3BDone

int

number of hands where player 3bet before flop

street0_4BChance

int

number of hands where player had chance to 4B before flop

street0_4BDone

int

number of hands where player 4bet before flop

street1Seen

int

number of hands where player saw flop/street4

street2Seen

int

number of hands where player saw turn/street5

street3Seen

int

number of hands where player saw river/street6

street4Seen

int

number of hands where player saw street7

sawShowdown

int

number of hands where player saw showdown

street1Aggr

int

number of hands where player raised flop/street4

street2Aggr

int

number of hands where player raised turn/street5

street3Aggr

int

number of hands where player raised river/street6

street4Aggr

int

number of hands where player raised street7

otherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3

otherRaisedStreet1

int

number of hands where someone else raised flop/street4

otherRaisedStreet2

int

number of hands where someone else raised turn/street5

otherRaisedStreet3

int

number of hands where someone else raised river/street6

otherRaisedStreet4

int

number of hands where someone else raised street7

foldToOtherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3 and the player folded

foldToOtherRaisedStreet1

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet2

int

number of hands where someone else raised Turn/street5 and the player folded

foldToOtherRaisedStreet3

int

number of hands where someone else raised River/street6 and the player folded

foldToOtherRaisedStreet4

int

number of hands where someone else raised street7 and the player folded

stealAttemptChance

int

Player was in CO, BTN or SB and nobody has called yet

stealAttempted

int

Player took a chance per the above condition

foldBbToStealChance

int

Somebody tried to steal BB from player

foldedBbToSteal

int

Player folded BB to steal attempt

foldSbToStealChance

int

Somebody tried to steal SB from player

foldedSbToSteal

int

Player folded SB to steal attempt

street1CBChance

int

Player had chance to make continuation bet on flop/street4

street1CBDone

int

Player used chance to make continuation bet on flop/street4

street2CBChance

int

Player had chance to make continuation bet on turn/street5

street2CBDone

int

Player used chance to make continuation bet on turn/street5

street3CBChance

int

Player had chance to make continuation bet on river/street6

street3CBDone

int

Player used chance to make continuation bet on river/street6

street4CBChance

int

Player had chance to make continuation bet on street7

street4CBDone

int

Player used chance to make continuation bet on street7

foldToStreet1CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet1CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet2CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet2CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet3CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet3CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet4CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet4CBDone

int

Player used chance to fold to continuation bet on this street

totalProfit

int

how much money in cents the player made

street1CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street1CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street0Calls

int

Number of times player called on this street

street1Calls

int

Number of times player called on this street

street2Calls

int

Number of times player called on this street

street3Calls

int

Number of times player called on this street

street4Calls

int

Number of times player called on this street

street0Bets

int

Number of times player bet on this street

street1Bets

int

Number of times player bet on this street

street2Bets

int

Number of times player bet on this street

street3Bets

int

Number of times player bet on this street

street4Bets

int

Number of times player bet on this street

street0Raises

int

Number of times player raised on this street

street1Raises

int

Number of times player raised on this street

street2Raises

int

Number of times player raised on this street

street3Raises

int

Number of times player raised on this street

street4Raises

int

Number of times player raised on this street

-

-

Table HandsActions

-

Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


handPlayerId

bigint

references HandsPlayers.id

street

smallint

street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud

-1 for seen showdown

actionNo

smallint

action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
- Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0

action

char(5)

Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned, this will have a negative value for amount.

-

Other valid values: blind call check fold

allIn

boolean

Whether the player went all-in on this action

amount

int

amount put into the middle for this action

comment

text


commentTs

datetime (in UTC)


-


-

Tournament Tables

-


-

Table Tourneys

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

int


tourneyTypeId

smallint

References TourneyTypes.id

siteTourneyNo

bigint


entries

int

-1 if unknown

prizepool

int

Need this as separate field to support rebuy/addon

-1 if unknown

startTime

datetime (in UTC)

Empty if unknown

comment

text


commentTs

datetime (in UTC)


-


-

Table TourneyTypes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


tourneyId

int

References Tourneys.id

playerId

int

References Players.id

payinAmount

int

Buyin, fee, rebuys and add-ons

rank

int

Finishing rank

winnings

signed int

Winnings (not profit) by this player, -1 if unknown.

comment

text


commentTs

datetime (in UTC)


-


-

Possible Changes

- - - - - - - - - - - - - - - - - - - - - -

Table

Comment

BoardCards

Remove as these attributes are now stored on Hands

HandsActions

Remove if/when these attributes are stored on Hands or elsewhere

HandsPlayers

Move tourneyTypeId field to Hands table.

Comments

Comment fields on various tables should probably be moved to a single comment table. Aim - should be to where possible reduce tables to a list of fixed length not-null columns and have - the larger, sparser comment columns in a dedicated table. (May not be possible or practical but - something to aim at.)

- - diff --git a/docs/fdl-1.2.txt b/fdl-1.2.txt similarity index 100% rename from docs/fdl-1.2.txt rename to fdl-1.2.txt diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index a3d32efe..3e9c2871 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -890,7 +890,7 @@ class fpdb: For documentation please visit our website at http://fpdb.sourceforge.net/. If you need help click on Contact - Get Help on our website. Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. -This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") +This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.") self.add_and_display_tab(mh_tab, "Help") def tab_table_viewer(self, widget, data=None): From 0cd213b6023c72a7d1adbdc19e9c4ec87a3e6d6f Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 13:42:23 +0200 Subject: [PATCH 109/425] removed two obselete files from utils --- utils/dump_db_basedata.py | 38 ------------------ utils/get_db_stats.py | 83 --------------------------------------- 2 files changed, 121 deletions(-) delete mode 100755 utils/dump_db_basedata.py delete mode 100755 utils/get_db_stats.py diff --git a/utils/dump_db_basedata.py b/utils/dump_db_basedata.py deleted file mode 100755 index f796c8ea..00000000 --- a/utils/dump_db_basedata.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -import sys -import MySQLdb - -db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb") -cursor = db.cursor() -print "Connected to MySQL on localhost. Printing dev-supplied base data:" - -cursor.execute("SELECT * FROM sites") -print "Sites" -print "=====" -print cursor.fetchall() - -cursor.execute("SELECT * FROM gametypes") -print "Gametypes" -print "=========" -result=cursor.fetchall() -for i in range (len(result)): - print result[i] - -cursor.close() -db.close() diff --git a/utils/get_db_stats.py b/utils/get_db_stats.py deleted file mode 100755 index 182baa38..00000000 --- a/utils/get_db_stats.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -import sys -import MySQLdb - -db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb") -cursor = db.cursor() -print "Connected to MySQL on localhost. Printing summary stats:" - -cursor.execute("SELECT id FROM Players") -print "Players:",cursor.rowcount -cursor.execute("SELECT id FROM Autorates") -print "Autorates:",cursor.rowcount - -cursor.execute("SELECT id FROM Sites") -print "Sites:",cursor.rowcount -cursor.execute("SELECT id FROM Gametypes") -print "Gametypes:",cursor.rowcount - -cursor.execute("SELECT id FROM Hands") -print "Total Hands:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='ring'") -print "Hands, Ring:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='stt'") -print "Hands, STT:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='mtt'") -print "Hands, MTT:",cursor.rowcount - -print "" -print "Hands per category and type" -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cn'") -print "Hands, Cap No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cp'") -print "Hands, Cap Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='nl'") -print "Hands, Holdem No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='pl'") -print "Hands, Holdem Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='fl'") -print "Hands, Holdem Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='nl'") -print "Hands, Omaha Hi No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='pl'") -print "Hands, Omaha Hi Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='fl'") -print "Hands, Omaha Hi Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='nl'") -print "Hands, Omaha Hi/Lo No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='pl'") -print "Hands, Omaha Hi/Lo Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='fl'") -print "Hands, Omaha Hi/Lo Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='razz'") -print "Hands, Razz:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhi'") -print "Hands, Stud Hi:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhilo'") -print "Hands, Stud Hi/Lo:",cursor.rowcount -print "" -cursor.execute("SELECT id FROM BoardCards") -print "Board_cards:",cursor.rowcount -cursor.execute("SELECT id FROM HandsPlayers") -print "Hands_players:",cursor.rowcount -cursor.execute("SELECT id FROM HandsActions") -print "Hands_actions:",cursor.rowcount - -cursor.close() -db.close() From e244a5d50213d7bb68f79f50f45f0984a3f94dc2 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:41:45 +0200 Subject: [PATCH 110/425] minor spelling correction --- pyfpdb/Hand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 71fc6ced..e57a8ecc 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -345,7 +345,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio self.actions['BLINDSANTES'].append(act) if blindtype == 'both': - # work with the real ammount. limit games are listed as $1, $2, where + # work with the real amount. limit games are listed as $1, $2, where # the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2.... amount = self.bb self.bets['BLINDSANTES'][player].append(Decimal(self.sb)) From cfcec2182e6285d27db7603938776fe9dc88f1d1 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:48:22 +0200 Subject: [PATCH 111/425] removed fields from Tourneys buyinChips, rebuyChips, addonChips, rebuyAmount, addonAmount and koBounty --- pyfpdb/AlchemyTables.py | 6 ------ pyfpdb/SQL.py | 37 +++---------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 2b0faa86..0aa5ad85 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -353,17 +353,11 @@ tourneys_table = Table('Tourneys', metadata, Column('prizepool', Integer), # INT NOT NULL Column('tourStartTime', DateTime), # DATETIME NOT NULL Column('tourEndTime', DateTime), # DATETIME - Column('buyinChips', Integer), # INT Column('tourneyName', String(40)), # varchar(40) # Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0 - Column('rebuyChips', Integer, default=0), # INT DEFAULT 0 - Column('addonChips', Integer, default=0), # INT DEFAULT 0 - Column('rebuyAmount', MoneyColumn, default=0), # INT DEFAULT 0 - Column('addonAmount', MoneyColumn, default=0), # INT DEFAULT 0 Column('totalRebuys', Integer, default=0), # INT DEFAULT 0 Column('totalAddons', Integer, default=0), # INT DEFAULT 0 - Column('koBounty', Integer, default=0), # INT DEFAULT 0 Column('comment', Text), # TEXT Column('commentTs', DateTime), # DATETIME mysql_charset='utf8', diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 8776178b..33c247cb 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -421,16 +421,10 @@ class Sql: prizepool INT NOT NULL, startTime DATETIME NOT NULL, endTime DATETIME, - buyinChips INT, tourneyName varchar(40), matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs DATETIME) ENGINE=INNODB""" @@ -443,16 +437,10 @@ class Sql: prizepool INT, startTime timestamp without time zone, endTime timestamp without time zone, - buyinChips INT, tourneyName varchar(40), matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs timestamp without time zone)""" elif db_server == 'sqlite': @@ -464,16 +452,10 @@ class Sql: prizepool INT, startTime REAL, endTime REAL, - buyinChips INT, tourneyName TEXT, matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs REAL)""" ################################ @@ -3614,16 +3596,10 @@ class Sql: t.prizepool, t.startTime, t.endTime, - t.buyinChips, t.tourneyName, t.matrixIdProcessed, - t.rebuyChips, - t.addonChips, - t.rebuyAmount, - t.addonAmount, t.totalRebuys, t.totalAddons, - t.koBounty, t.comment FROM Tourneys t INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id) @@ -3632,11 +3608,10 @@ class Sql: self.query['insertTourney'] = """INSERT INTO Tourneys (tourneyTypeId, siteTourneyNo, entries, prizepool, - startTime, endTime, buyinChips, tourneyName, matrixIdProcessed, - rebuyChips, addonChips, rebuyAmount, addonAmount, totalRebuys, - totalAddons, koBounty, comment, commentTs) + startTime, endTime, tourneyName, matrixIdProcessed, + totalRebuys, totalAddons, comment, commentTs) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s) + %s, %s) """ self.query['updateTourney'] = """UPDATE Tourneys @@ -3645,16 +3620,10 @@ class Sql: prizepool = %s, startTime = %s, endTime = %s, - buyinChips = %s, tourneyName = %s, matrixIdProcessed = %s, - rebuyChips = %s, - addonChips = %s, - rebuyAmount = %s, - addonAmount = %s, totalRebuys = %s, totalAddons = %s, - koBounty = %s, comment = %s, commentTs = %s WHERE id=%s From d83c68d57823fa6b0b0b9ff65fd92f998e619a73 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:54:32 +0200 Subject: [PATCH 112/425] fix silly mistake i made when changing start screen text --- pyfpdb/fpdb.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 92d3f6f7..6d61038f 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -890,7 +890,7 @@ class fpdb: For documentation please visit our website at http://fpdb.sourceforge.net/. If you need help click on Contact - Get Help on our website. Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. -This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.") +This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.""") self.add_and_display_tab(mh_tab, "Help") def tab_table_viewer(self, widget, data=None): From e6fd3afbba04bf28e20b0223f527b9e3a74a6d70 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 16:45:15 +0200 Subject: [PATCH 113/425] renamed totalRebuys/AddOns to totalRebuyCount/AddOnCount --- pyfpdb/AlchemyTables.py | 4 ++-- pyfpdb/FulltiltToFpdb.py | 4 ++-- pyfpdb/SQL.py | 22 +++++++++++----------- pyfpdb/Tourney.py | 13 +++++++------ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 0aa5ad85..003716b6 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -356,8 +356,8 @@ tourneys_table = Table('Tourneys', metadata, Column('tourneyName', String(40)), # varchar(40) # Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0 - Column('totalRebuys', Integer, default=0), # INT DEFAULT 0 - Column('totalAddons', Integer, default=0), # INT DEFAULT 0 + Column('totalRebuyCount', Integer, default=0), # INT DEFAULT 0 + Column('totalAddOnCount', Integer, default=0), # INT DEFAULT 0 Column('comment', Text), # TEXT Column('commentTs', DateTime), # DATETIME mysql_charset='utf8', diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 2c6370e6..1503e10d 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -582,8 +582,8 @@ class Fulltilt(HandHistoryConverter): "PRIZEPOOL" : "prizepool", "REBUY_AMOUNT" : "rebuyAmount", "ADDON_AMOUNT" : "addOnAmount", - "REBUY_TOTAL" : "totalRebuys", - "ADDONS_TOTAL" : "totalAddOns", + "REBUY_TOTAL" : "totalRebuyCount", + "ADDONS_TOTAL" : "totalAddOnCount", "REBUY_CHIPS" : "rebuyChips", "ADDON_CHIPS" : "addOnChips", "STARTTIME" : "starttime", diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 33c247cb..ae6be545 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -423,8 +423,8 @@ class Sql: endTime DATETIME, tourneyName varchar(40), matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs DATETIME) ENGINE=INNODB""" @@ -439,8 +439,8 @@ class Sql: endTime timestamp without time zone, tourneyName varchar(40), matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs timestamp without time zone)""" elif db_server == 'sqlite': @@ -454,8 +454,8 @@ class Sql: endTime REAL, tourneyName TEXT, matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs REAL)""" ################################ @@ -3598,8 +3598,8 @@ class Sql: t.endTime, t.tourneyName, t.matrixIdProcessed, - t.totalRebuys, - t.totalAddons, + t.totalRebuyCount, + t.totalAddOnCount, t.comment FROM Tourneys t INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id) @@ -3609,7 +3609,7 @@ class Sql: self.query['insertTourney'] = """INSERT INTO Tourneys (tourneyTypeId, siteTourneyNo, entries, prizepool, startTime, endTime, tourneyName, matrixIdProcessed, - totalRebuys, totalAddons, comment, commentTs) + totalRebuyCount, totalAddOnCount, comment, commentTs) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """ @@ -3622,8 +3622,8 @@ class Sql: endTime = %s, tourneyName = %s, matrixIdProcessed = %s, - totalRebuys = %s, - totalAddons = %s, + totalRebuyCount = %s, + totalAddonCount = %s, comment = %s, commentTs = %s WHERE id=%s diff --git a/pyfpdb/Tourney.py b/pyfpdb/Tourney.py index 281a6710..5cc5d03a 100644 --- a/pyfpdb/Tourney.py +++ b/pyfpdb/Tourney.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2009 Stephane Alessio #This program is free software: you can redistribute it and/or modify @@ -73,10 +74,10 @@ class Tourney(object): self.subTourneyFee = None self.rebuyChips = 0 self.addOnChips = 0 - self.rebuyAmount = 0 - self.addOnAmount = 0 - self.totalRebuys = 0 - self.totalAddOns = 0 + self.rebuyAmount = 0 + self.addOnAmount = 0 + self.totalRebuyCount = 0 + self.totalAddOnCount = 0 self.koBounty = 0 self.tourneyComment = None self.players = [] @@ -121,8 +122,8 @@ class Tourney(object): ("ADDON CHIPS", self.addOnChips), ("REBUY AMOUNT", self.rebuyAmount), ("ADDON AMOUNT", self.addOnAmount), - ("TOTAL REBUYS", self.totalRebuys), - ("TOTAL ADDONS", self.totalAddOns), + ("TOTAL REBUYS", self.totalRebuyCount), + ("TOTAL ADDONS", self.totalAddOnCount), ("KO BOUNTY", self.koBounty), ("TOURNEY COMMENT", self.tourneyComment) ) From e46b0b7a0f4a9fd11e6584832c1c6e1342ccca6b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 17:12:20 +0200 Subject: [PATCH 114/425] renamed tourneyplayers to tourneysplayers in a few places --- pyfpdb/AlchemyMappings.py | 8 ++++---- pyfpdb/FulltiltToFpdb.py | 8 ++++---- pyfpdb/SummaryEverleaf.py | 7 ++++--- pyfpdb/TournamentTracker.py | 3 ++- pyfpdb/Tourney.py | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pyfpdb/AlchemyMappings.py b/pyfpdb/AlchemyMappings.py index 7b9c20a3..86b78bd9 100644 --- a/pyfpdb/AlchemyMappings.py +++ b/pyfpdb/AlchemyMappings.py @@ -185,7 +185,7 @@ class HandInternal(DerivedStats): # fetch and update tourney players for hp in self.handPlayers: - tp = TourneyPlayer.get_or_create(session, tour.id, hp.playerId) + tp = TourneysPlayer.get_or_create(session, tour.id, hp.playerId) # FIXME: other TourneysPlayers should be added here session.flush() @@ -387,7 +387,7 @@ class TourneyType(MappedBase): return get_or_create(cls, session, **kwargs)[0] -class TourneyPlayer(MappedBase): +class TourneysPlayer(MappedBase): """Class reflecting TourneysPlayers db table""" @classmethod @@ -439,7 +439,7 @@ mapper (Gametype, gametypes_table, properties={ }) mapper (Player, players_table, properties={ 'playerHands': relation(HandPlayer, backref='player'), - 'playerTourney': relation(TourneyPlayer, backref='player'), + 'playerTourney': relation(TourneysPlayer, backref='player'), }) mapper (Site, sites_table, properties={ 'gametypes': relation(Gametype, backref = 'site'), @@ -457,7 +457,7 @@ mapper (Tourney, tourneys_table) mapper (TourneyType, tourney_types_table, properties={ 'tourneys': relation(Tourney, backref='type'), }) -mapper (TourneyPlayer, tourneys_players_table) +mapper (TourneysPlayer, tourneys_players_table) class LambdaKeyDict(defaultdict): """Operates like defaultdict but passes key argument to the factory function""" diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 1503e10d..b99cc073 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -66,7 +66,7 @@ class Fulltilt(HandHistoryConverter): ''', re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P