From 423753de179901d2fddfd6b1ef556e1f82aec536 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 15 Aug 2008 03:32:27 +0100 Subject: [PATCH] git38 - make HudData tables positional (sf request 2052124) --- docs/known-bugs-and-planned-features.txt | 4 +- docs/tabledesign.html | 183 ++++++----------------- pyfpdb/fpdb.py | 2 +- pyfpdb/fpdb_db.py | 34 +++-- pyfpdb/fpdb_simple.py | 29 +++- 5 files changed, 94 insertions(+), 158 deletions(-) diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt index ced9c7cd..9fde4b0a 100644 --- a/docs/known-bugs-and-planned-features.txt +++ b/docs/known-bugs-and-planned-features.txt @@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc alpha2 (release by 17Aug) ====== -make HudData tables positional +fold to CB/2B/3B move version into seperate file for fpdb gui and db auto-import seperate and improve instructions for update @@ -17,6 +17,7 @@ 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 +verify positionalness of HudData printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring-successful-steal-by-cutoff.txt and ps-lhe-ring-call-3B-preflop-cb-no2b.txt alpha3 @@ -31,6 +32,7 @@ fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might a before beta =========== +optionally make tv positional gentoo ebuild: USE postgresql skins optionally combine FB/FS and CB/2B/3B diff --git a/docs/tabledesign.html b/docs/tabledesign.html index b5144967..30cd86cc 100644 --- a/docs/tabledesign.html +++ b/docs/tabledesign.html @@ -543,6 +543,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt

int

Player used chance to make third barrel bet

+ +

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)

+

Table HandsActions

@@ -622,102 +627,47 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt


- -

buyin

- - -

int

- - -

Buy-in in cents. Without rebuy/add-on

- +

buyin

+

int

+

Buy-in in cents. Without rebuy/add-on

- -

fee

- - -

int

- - -


-

- +

fee

+

int

+


- -

knockout

- - -

int

- - -


-

- +

knockout

+

int

+


- -

entries

- - -

int

- - -

-1 if unknown

- +

entries

+

int

+

-1 if unknown

- -

prizepool

- - -

int

- - -

Need - this as separate field to support rebuy/addon

-

-1 if unknown

- +

prizepool

+

int

+

Need this as separate field to support rebuy/addon

-1 if unknown

- -

startTime

- - -

datetime (in UTC)

- - -

Empty if unknown

- +

startTime

+

datetime (in UTC)

+

Empty if unknown

- -

comment

- - -

text

- - -


-

- +

comment

+

text

+


- -

commentTs

- - -

datetime (in UTC)

- - -


-

- +

commentTs

+

datetime (in UTC)

+


-


-

+


Table TourneysPlayers

@@ -736,71 +686,34 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt

- - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +

References Tourneys.id

-

playerId

-
-

int

-
-

References Players.id

-

playerId

int

References Players.id

-

payinAmount

-
-

int

-
-

Buyin, fee, rebuys and add-ons

-

payinAmount

int

Buyin, fee, rebuys and add-ons

-

rank

-
-

int

-
-

Finishing rank

-

rank

int

Finishing rank

-

winnings

-
-

signed int

-
-

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

-

winnings

signed int

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

-

comment

-
-

text

-
-


-

-

comment

text


-

commentTs

-
-

datetime (in UTC)

-
-


-

commentTs

datetime (in UTC)


diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 6bca690e..e8a6f822 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+, git37") + self.window.set_title("Free Poker DB - version: alpha1+, git38") 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 b7d07370..13e63568 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]!=35: + if settings[0]!=38: print "outdated database version - please recreate tables" except:# _mysql_exceptions.ProgrammingError: print "failed to read settings table - please recreate tables" @@ -111,19 +111,19 @@ class fpdb_db: self.cursor.execute("DROP TABLE IF EXISTS players;") self.cursor.execute("DROP TABLE IF EXISTS gametypes;") self.cursor.execute("DROP TABLE IF EXISTS sites;") - else: - self.cursor.execute("DROP TABLE IF EXISTS Settings;") - self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;") - self.cursor.execute("DROP TABLE IF EXISTS Autorates;") - self.cursor.execute("DROP TABLE IF EXISTS BoardCards;") - 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 TourneysPlayers;") - self.cursor.execute("DROP TABLE IF EXISTS Tourneys;") - self.cursor.execute("DROP TABLE IF EXISTS Players;") - self.cursor.execute("DROP TABLE IF EXISTS Gametypes;") - self.cursor.execute("DROP TABLE IF EXISTS Sites;") + + self.cursor.execute("DROP TABLE IF EXISTS Settings;") + self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;") + self.cursor.execute("DROP TABLE IF EXISTS Autorates;") + self.cursor.execute("DROP TABLE IF EXISTS BoardCards;") + 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 TourneysPlayers;") + self.cursor.execute("DROP TABLE IF EXISTS Tourneys;") + self.cursor.execute("DROP TABLE IF EXISTS Players;") + self.cursor.execute("DROP TABLE IF EXISTS Gametypes;") + self.cursor.execute("DROP TABLE IF EXISTS Sites;") self.db.commit() #end def drop_tables @@ -305,9 +305,11 @@ class fpdb_db: secondBarrelChance INT, secondBarrelDone INT, thirdBarrelChance INT, - thirdBarrelDone INT)""") + thirdBarrelDone INT, - self.cursor.execute("INSERT INTO Settings VALUES (35);") + position CHAR(1))""") + + self.cursor.execute("INSERT INTO Settings VALUES (38);") 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_simple.py b/pyfpdb/fpdb_simple.py index d661421b..2d29a39d 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1247,6 +1247,7 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings wonAtSD=[] stealAttemptChance=[] stealAttempted=[] + hudDataPositions=[] firstPfRaiseByNo=-1 firstPfRaiserId=-1 @@ -1456,6 +1457,21 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings wonAtSD.append(myWonAtSD) stealAttemptChance.append(myStealAttemptChance) stealAttempted.append(myStealAttempted) + pos=positions[player] + if pos=='B': + hudDataPositions.append('B') + elif pos=='S': + hudDataPositions.append('S') + elif pos==0: + hudDataPositions.append('D') + elif pos==1: + hudDataPositions.append('C') + elif pos>=2 and pos<=4: + hudDataPositions.append('M') + elif pos>=5 and pos<=7: + hudDataPositions.append('L') + else: + raise FpdbError("invalid position") #add each array to the to-be-returned dictionary result={'VPIP':VPIP} @@ -1564,13 +1580,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings result['thirdBarrelChance']=thirdBarrelChance result['thirdBarrelDone']=thirdBarrelDone + result['position']=hudDataPositions return result #end def calculateHudImport def storeHudData(cursor, category, gametypeId, playerIds, hudImportData): if (category=="holdem" or category=="omahahi" or category=="omahahilo"): for player in range (len(playerIds)): - cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (gametypeId, playerIds[player], len(playerIds))) + cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s", (gametypeId, playerIds[player], len(playerIds), hudImportData['position'][player])) row=cursor.fetchone() #print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row @@ -1589,6 +1606,7 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData): row.append(0)#HDs for i in range(len(hudImportData)): row.append(0) + else: doInsert=False newrow=[] @@ -1629,17 +1647,18 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData): if hudImportData['secondBarrelDone'][player]: row[33]+=1 if hudImportData['thirdBarrelChance'][player]: row[34]+=1 if hudImportData['thirdBarrelDone'][player]: row[35]+=1 - + row[36]=hudImportData['position'][player] + if doInsert: #print "playerid before insert:",row[2] cursor.execute("""INSERT INTO HudDataHoldemOmaha - (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone) - VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35])) + (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone, position) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[36])) else: #print "storing updated hud data line" cursor.execute("""UPDATE HudDataHoldemOmaha SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%s - WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3])) + WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3], row[36])) else: raise FpdbError("todo") #end def storeHudData