git38 - make HudData tables positional (sf request 2052124)

This commit is contained in:
steffen123 2008-08-15 03:32:27 +01:00
parent 732edf9e69
commit 423753de17
5 changed files with 94 additions and 158 deletions

View File

@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug) alpha2 (release by 17Aug)
====== ======
make HudData tables positional fold to CB/2B/3B
move version into seperate file for fpdb gui and db move version into seperate file for fpdb gui and db
auto-import auto-import
seperate and improve instructions for update seperate and improve instructions for update
@ -17,6 +17,7 @@ update abbreviations.txt
fix up bg colours in tv 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 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 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 alpha3
@ -31,6 +32,7 @@ fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might a
before beta before beta
=========== ===========
optionally make tv positional
gentoo ebuild: USE postgresql gentoo ebuild: USE postgresql
skins skins
optionally combine FB/FS and CB/2B/3B optionally combine FB/FS and CB/2B/3B

View File

@ -543,6 +543,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P>Player used chance to make third barrel bet</P></TD> <TD><P>Player used chance to make third barrel bet</P></TD>
</TR> </TR>
<TR VALIGN=TOP>
<TD><P>position</P></TD>
<TD><P>char(1)</P></TD>
<TD><P>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)</P></TD>
</TR>
</TABLE> </TABLE>
<P></P> <P></P>
<P><B>Table HandsActions</B></P> <P><B>Table HandsActions</B></P>
@ -622,102 +627,47 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>buyin</P></TD>
<P>buyin</P> <TD><P>int</P></TD>
</TD> <TD><P>Buy-in in cents. Without rebuy/add-on</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Buy-in in cents. Without rebuy/add-on</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>fee</P></TD>
<P>fee</P> <TD><P>int</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>knockout</P></TD>
<P>knockout</P> <TD><P>int</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>entries</P></TD>
<P>entries</P> <TD><P>int</P></TD>
</TD> <TD><P>-1 if unknown</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>-1 if unknown</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>prizepool</P></TD>
<P>prizepool</P> <TD><P>int</P></TD>
</TD> <TD><p>Need this as separate field to support rebuy/addon</P><P>-1 if unknown</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<p>Need
this as separate field to support rebuy/addon</P>
<P>-1 if unknown</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>startTime</P></TD>
<P>startTime</P> <TD><P>datetime (in UTC)</P></TD>
</TD> <TD><P>Empty if unknown</P></TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P>Empty if unknown</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>comment</P></TD>
<P>comment</P> <TD><P>text</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>text</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>commentTs</P></TD>
<P>commentTs</P> <TD><P>datetime (in UTC)</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR> <p><BR></P>
</P>
<p><B>Table TourneysPlayers</B></P> <p><B>Table TourneysPlayers</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -736,71 +686,34 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P>References Tourneys.id</P></TD> <TD><P>References Tourneys.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>playerId</P></TD>
<P>playerId</P> <TD><P>int</P></TD>
</TD> <TD><P>References Players.id</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>References Players.id</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>payinAmount</P></TD>
<P>payinAmount</P> <TD><P>int</P></TD>
</TD> <TD><P>Buyin, fee, rebuys and add-ons</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Buyin, fee, rebuys and add-ons</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>rank</P></TD>
<P>rank</P> <TD><P>int</P></TD>
</TD> <TD><P>Finishing rank</P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Finishing rank</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>winnings</P></TD>
<P>winnings</P> <TD><P>signed int</P></TD>
</TD> <TD><P>Winnings (not profit) by this player, -1 if unknown.</P></TD>
<TD>
<P>signed int</P>
</TD>
<TD>
<P>Winnings (not profit) by this player, -1 if unknown.</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>comment</P></TD>
<P>comment</P> <TD><P>text</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>text</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>commentTs</P></TD>
<P>commentTs</P> <TD><P>datetime (in UTC)</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR></P>
</TD>
</TR> </TR>
</TABLE> </TABLE>
</BODY> </BODY>

View File

@ -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 = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) 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_border_width(1)
self.window.set_size_request(1020,400) self.window.set_size_request(1020,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

@ -47,7 +47,7 @@ class fpdb_db:
try: try:
self.cursor.execute("SELECT * FROM Settings") self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone() settings=self.cursor.fetchone()
if settings[0]!=35: if settings[0]!=38:
print "outdated database version - please recreate tables" print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError: except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables" print "failed to read settings table - please recreate tables"
@ -111,7 +111,7 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS players;") self.cursor.execute("DROP TABLE IF EXISTS players;")
self.cursor.execute("DROP TABLE IF EXISTS gametypes;") self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
self.cursor.execute("DROP TABLE IF EXISTS sites;") self.cursor.execute("DROP TABLE IF EXISTS sites;")
else:
self.cursor.execute("DROP TABLE IF EXISTS Settings;") self.cursor.execute("DROP TABLE IF EXISTS Settings;")
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;") self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
self.cursor.execute("DROP TABLE IF EXISTS Autorates;") self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
@ -305,9 +305,11 @@ class fpdb_db:
secondBarrelChance INT, secondBarrelChance INT,
secondBarrelDone INT, secondBarrelDone INT,
thirdBarrelChance 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, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');") self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit() self.db.commit()

View File

@ -1247,6 +1247,7 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD=[] wonAtSD=[]
stealAttemptChance=[] stealAttemptChance=[]
stealAttempted=[] stealAttempted=[]
hudDataPositions=[]
firstPfRaiseByNo=-1 firstPfRaiseByNo=-1
firstPfRaiserId=-1 firstPfRaiserId=-1
@ -1456,6 +1457,21 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD.append(myWonAtSD) wonAtSD.append(myWonAtSD)
stealAttemptChance.append(myStealAttemptChance) stealAttemptChance.append(myStealAttemptChance)
stealAttempted.append(myStealAttempted) 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 #add each array to the to-be-returned dictionary
result={'VPIP':VPIP} result={'VPIP':VPIP}
@ -1564,13 +1580,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['thirdBarrelChance']=thirdBarrelChance result['thirdBarrelChance']=thirdBarrelChance
result['thirdBarrelDone']=thirdBarrelDone result['thirdBarrelDone']=thirdBarrelDone
result['position']=hudDataPositions
return result return result
#end def calculateHudImport #end def calculateHudImport
def storeHudData(cursor, category, gametypeId, playerIds, hudImportData): def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
for player in range (len(playerIds)): 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() row=cursor.fetchone()
#print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row #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 row.append(0)#HDs
for i in range(len(hudImportData)): for i in range(len(hudImportData)):
row.append(0) row.append(0)
else: else:
doInsert=False doInsert=False
newrow=[] newrow=[]
@ -1629,17 +1647,18 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['secondBarrelDone'][player]: row[33]+=1 if hudImportData['secondBarrelDone'][player]: row[33]+=1
if hudImportData['thirdBarrelChance'][player]: row[34]+=1 if hudImportData['thirdBarrelChance'][player]: row[34]+=1
if hudImportData['thirdBarrelDone'][player]: row[35]+=1 if hudImportData['thirdBarrelDone'][player]: row[35]+=1
row[36]=hudImportData['position'][player]
if doInsert: if doInsert:
#print "playerid before insert:",row[2] #print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha 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) (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)""", (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])) 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: else:
#print "storing updated hud data line" #print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha 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 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: else:
raise FpdbError("todo") raise FpdbError("todo")
#end def storeHudData #end def storeHudData