git21 - added fpdb version into db to detect outdated db format. added fields for steals to DB and placeholder inserts to importer. lots of doc updates
split pygtk requirements, cleaned table design HTML more noticed its really slow now - might be because I'm running it over LAN. will figure this out shortly
This commit is contained in:
+1
-1
@@ -343,7 +343,7 @@ blabla""")
|
||||
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: pre-alpha, git20")
|
||||
self.window.set_title("Free Poker DB - version: pre-alpha, git21")
|
||||
self.window.set_border_width(1)
|
||||
self.window.set_size_request(950,400)
|
||||
self.window.set_resizable(True)
|
||||
|
||||
+21
-5
@@ -34,10 +34,8 @@ class fpdb_db:
|
||||
self.database=database
|
||||
self.user=user
|
||||
self.password=password
|
||||
#print "fpdb_db.connect, password:",password,"/end"
|
||||
if backend==self.MYSQL_INNODB:
|
||||
import MySQLdb
|
||||
#print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
|
||||
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
|
||||
elif backend==self.PGSQL:
|
||||
import pgdb
|
||||
@@ -45,6 +43,13 @@ class fpdb_db:
|
||||
else:
|
||||
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
|
||||
self.cursor=self.db.cursor()
|
||||
#try:
|
||||
# self.cursor.execute("SELECT * FROM settings")
|
||||
# settings=self.cursor.fetchone()
|
||||
# if settings[0]!=21:
|
||||
# print "outdated database version - please recreate tables"
|
||||
#except:# _mysql_exceptions.ProgrammingError:
|
||||
# print "failed to read settings table - please recreate tables"
|
||||
#end def connect
|
||||
|
||||
def create_table(self, string):
|
||||
@@ -80,8 +85,9 @@ class fpdb_db:
|
||||
|
||||
def drop_tables(self):
|
||||
"""Drops the fpdb tables from the current db"""
|
||||
self.cursor.execute("DROP TABLE IF EXISTS settings;")
|
||||
|
||||
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
|
||||
#self.cursor.execute("DROP TABLE IF EXISTS hands_players_flags;")
|
||||
self.cursor.execute("DROP TABLE IF EXISTS autorates;")
|
||||
self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
|
||||
self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
|
||||
@@ -113,6 +119,9 @@ class fpdb_db:
|
||||
"""(Re-)creates the tables of the current DB"""
|
||||
self.drop_tables()
|
||||
|
||||
self.create_table("""settings (
|
||||
version SMALLINT)""")
|
||||
|
||||
self.create_table("""sites (
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
name varchar(32),
|
||||
@@ -263,9 +272,16 @@ class fpdb_db:
|
||||
otherRaisedRiver INT,
|
||||
otherRaisedRiverFold INT,
|
||||
wonWhenSeenFlop FLOAT,
|
||||
wonAtSD FLOAT)""")
|
||||
wonAtSD FLOAT,
|
||||
stealAttemptChance INT,
|
||||
stealAttempted INT,
|
||||
foldBbToStealChance INT,
|
||||
foldedBbToSteal INT,
|
||||
foldSbToStealChance INT,
|
||||
foldedSbToSteal INT)""")
|
||||
|
||||
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
|
||||
self.cursor.execute("INSERT INTO settings VALUES (21);")
|
||||
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()
|
||||
print "finished recreating tables"
|
||||
|
||||
+34
-4
@@ -1247,6 +1247,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
|
||||
otherRaisedRiverFold=[]
|
||||
wonWhenSeenFlop=[]
|
||||
wonAtSD=[]
|
||||
stealAttemptChance=[]
|
||||
stealAttempted=[]
|
||||
foldBbToStealChance=[]
|
||||
foldedBbToSteal=[]
|
||||
foldSbToStealChance=[]
|
||||
foldedSbToSteal=[]
|
||||
|
||||
firstPfRaise=-1
|
||||
for i in range(len(actionTypeByNo[0])):
|
||||
@@ -1275,6 +1281,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
|
||||
myOtherRaisedRiverFold=False
|
||||
myWonWhenSeenFlop=0.0
|
||||
myWonAtSD=0.0
|
||||
myStealAttemptChance=False
|
||||
myStealAttempted=False
|
||||
myFoldBbToStealChance=False
|
||||
myFoldedBbToSteal=False
|
||||
myFoldSbToStealChance=False
|
||||
myFoldedSbToSteal=False
|
||||
|
||||
#calculate VPIP and PFR
|
||||
street=0
|
||||
@@ -1394,6 +1406,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
|
||||
otherRaisedRiverFold.append(myOtherRaisedRiverFold)
|
||||
wonWhenSeenFlop.append(myWonWhenSeenFlop)
|
||||
wonAtSD.append(myWonAtSD)
|
||||
stealAttemptChance.append(myStealAttemptChance)
|
||||
stealAttempted.append(myStealAttempted)
|
||||
foldBbToStealChance.append(myFoldBbToStealChance)
|
||||
foldedBbToSteal.append(myFoldedBbToSteal)
|
||||
foldSbToStealChance.append(myFoldSbToStealChance)
|
||||
foldedSbToSteal.append(myFoldedSbToSteal)
|
||||
|
||||
#add each array to the to-be-returned dictionary
|
||||
result={'VPIP':VPIP}
|
||||
@@ -1415,6 +1433,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
|
||||
result['otherRaisedRiverFold']=otherRaisedRiverFold
|
||||
result['wonWhenSeenFlop']=wonWhenSeenFlop
|
||||
result['wonAtSD']=wonAtSD
|
||||
result['stealAttemptChance']=stealAttemptChance
|
||||
result['stealAttempted']=stealAttempted
|
||||
result['foldBbToStealChance']=foldBbToStealChance
|
||||
result['foldedBbToSteal']=foldedBbToSteal
|
||||
result['foldSbToStealChance']=foldSbToStealChance
|
||||
result['foldedSbToSteal']=foldedSbToSteal
|
||||
return result
|
||||
#end def calculateHudImport
|
||||
|
||||
@@ -1467,17 +1491,23 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
|
||||
if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
|
||||
if hudImportData['wonWhenSeenFlop'][player]!=0.0: row[22]+=hudImportData['wonWhenSeenFlop'][player]
|
||||
if hudImportData['wonAtSD'][player]!=0.0: row[23]+=hudImportData['wonAtSD'][player]
|
||||
if hudImportData['stealAttemptChance'][player]: row[24]+=1
|
||||
if hudImportData['stealAttempted'][player]: row[25]+=1
|
||||
if hudImportData['foldBbToStealChance'][player]: row[26]+=1
|
||||
if hudImportData['foldedBbToSteal'][player]: row[27]+=1
|
||||
if hudImportData['foldSbToStealChance'][player]: row[28]+=1
|
||||
if hudImportData['foldedSbToSteal'][player]: row[29]+=1
|
||||
|
||||
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)
|
||||
VALUES (%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]))
|
||||
(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)
|
||||
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)""", (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]))
|
||||
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
|
||||
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[1], row[2], row[3]))
|
||||
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
|
||||
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[1], row[2], row[3]))
|
||||
else:
|
||||
raise FpdbError("todo")
|
||||
#end def storeHudData
|
||||
|
||||
@@ -59,7 +59,7 @@ class table_viewer (threading.Thread):
|
||||
arr=[]
|
||||
#first prepare the header row
|
||||
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
|
||||
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wSF", "W$@SD")
|
||||
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
|
||||
else:
|
||||
raise fpdb_simple.FpdbError("reimplement stud")
|
||||
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
|
||||
|
||||
Reference in New Issue
Block a user