several db changes and a fancy playerstats window, now to tidy the code up a bit ....
This commit is contained in:
parent
93f643a958
commit
cf8b6c7e92
68
pyfpdb/Card.py
Executable file
68
pyfpdb/Card.py
Executable file
|
@ -0,0 +1,68 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
#Copyright 2008 Carl Gherardi
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in
|
||||||
|
#agpl-3.0.txt in the docs folder of the package.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def twoStartCards(value1, suit1, value2, suit2):
|
||||||
|
""" Function to convert 2 value,suit pairs into a Holdem style starting hand e.g. AQo
|
||||||
|
Hand is stored as an int 13 * x + y where (x+2) represents rank of 1st card and
|
||||||
|
(y+2) represents rank of second card (2=2 .. 14=Ace)
|
||||||
|
If x > y then pair is suited, if x < y then unsuited"""
|
||||||
|
if value1 < 2 or value2 < 2:
|
||||||
|
return(0)
|
||||||
|
if (suit1 == suit2 and value1 < value2) or (suit1 != suit2 and value2 > value1):
|
||||||
|
return(13 * (value2-2) + (value1-1))
|
||||||
|
else:
|
||||||
|
return(13 * (value1-2) + (value2-1))
|
||||||
|
|
||||||
|
def twoStartCardString(card):
|
||||||
|
""" Function to convert an int representing 2 holdem hole cards (as created by twoStartCards)
|
||||||
|
into a string like AQo """
|
||||||
|
if card <= 0:
|
||||||
|
return 'xx'
|
||||||
|
else:
|
||||||
|
card -= 1
|
||||||
|
s = ('2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
|
||||||
|
x = card/13
|
||||||
|
y = card - 13*x
|
||||||
|
if x == y: return(s[x] + s[y])
|
||||||
|
elif x > y: return(s[x] + s[y] + 's')
|
||||||
|
else: return(s[y] + s[x] + 'o')
|
||||||
|
|
||||||
|
def cardFromValueSuit(value, suit):
|
||||||
|
""" 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As """
|
||||||
|
if suit == 'h': return(value-1)
|
||||||
|
elif suit == 'd': return(value+12)
|
||||||
|
elif suit == 'c': return(value+25)
|
||||||
|
elif suit == 's': return(value+38)
|
||||||
|
else: return(0)
|
||||||
|
|
||||||
|
def valueSuitFromCard(card):
|
||||||
|
""" Function to convert a card stored in the database (int 0-52) into value
|
||||||
|
and suit like 9s, 4c etc """
|
||||||
|
if card < 0 or card > 52:
|
||||||
|
return('')
|
||||||
|
else:
|
||||||
|
return( ['', '2h', '3h', '4h', '5h', '6h', '7h', '8h', '9h', 'Th', 'Jh', 'Qh', 'Kh', 'Ah'
|
||||||
|
, '2d', '3d', '4d', '5d', '6d', '7d', '8d', '9d', 'Td', 'Jd', 'Qd', 'Kd', 'Ad'
|
||||||
|
, '2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', 'Tc', 'Jc', 'Qc', 'Kc', 'Ac'
|
||||||
|
, '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', 'Ts', 'Js', 'Qs', 'Ks', 'As'
|
||||||
|
][card] )
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import traceback
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
import Configuration
|
import Configuration
|
||||||
import SQL
|
import SQL
|
||||||
|
import Card
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
def __init__(self, c, db_name, game):
|
def __init__(self, c, db_name, game):
|
||||||
|
@ -78,6 +79,7 @@ class Database:
|
||||||
|
|
||||||
self.type = c.supported_databases[db_name].db_type
|
self.type = c.supported_databases[db_name].db_type
|
||||||
self.sql = SQL.Sql(game = game, type = self.type)
|
self.sql = SQL.Sql(game = game, type = self.type)
|
||||||
|
self.connection.rollback()
|
||||||
|
|
||||||
def close_connection(self):
|
def close_connection(self):
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
|
@ -122,11 +124,17 @@ class Database:
|
||||||
c = self.connection.cursor()
|
c = self.connection.cursor()
|
||||||
c.execute(self.sql.query['get_cards'], [hand])
|
c.execute(self.sql.query['get_cards'], [hand])
|
||||||
colnames = [desc[0] for desc in c.description]
|
colnames = [desc[0] for desc in c.description]
|
||||||
|
cardnames = ['card1', 'card2', 'card3', 'card4', 'card5', 'card6', 'card7']
|
||||||
for row in c.fetchall():
|
for row in c.fetchall():
|
||||||
s_dict = {}
|
cs = ['', '', '', '', '', '', '']
|
||||||
for name, val in zip(colnames, row):
|
seat = -1
|
||||||
s_dict[name] = val
|
for col,name in enumerate(colnames):
|
||||||
cards[s_dict['seat_number']] = (self.convert_cards(s_dict))
|
if name in cardnames:
|
||||||
|
cs[cardnames.index(name)] = Card.valueSuitFromCard(row[col])
|
||||||
|
elif name == 'seat_number':
|
||||||
|
seat = row[col]
|
||||||
|
if seat != -1:
|
||||||
|
cards[seat] = ''.join(cs)
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
def get_common_cards(self, hand):
|
def get_common_cards(self, hand):
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Filters(threading.Thread):
|
||||||
self.settings=settings
|
self.settings=settings
|
||||||
self.sql=qdict
|
self.sql=qdict
|
||||||
self.conf = config
|
self.conf = config
|
||||||
|
self.display = display
|
||||||
|
|
||||||
self.sites = {}
|
self.sites = {}
|
||||||
self.games = {}
|
self.games = {}
|
||||||
|
@ -45,10 +46,12 @@ class Filters(threading.Thread):
|
||||||
self.seats = {}
|
self.seats = {}
|
||||||
self.siteid = {}
|
self.siteid = {}
|
||||||
self.heroes = {}
|
self.heroes = {}
|
||||||
|
self.boxes = {}
|
||||||
|
|
||||||
# text used on screen stored here so that it can be configured
|
# text used on screen stored here so that it can be configured
|
||||||
self.filterText = {'limitsall':'All', 'limitsnone':'None', 'limitsshow':'Show Limits'
|
self.filterText = {'limitsall':'All', 'limitsnone':'None', 'limitsshow':'Show _Limits'
|
||||||
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Seats'
|
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Number of _Players'
|
||||||
|
,'limitstitle':'Limits:', 'seatstitle':'Number of Players:'
|
||||||
}
|
}
|
||||||
|
|
||||||
# For use in date ranges.
|
# For use in date ranges.
|
||||||
|
@ -66,6 +69,7 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
self.fillPlayerFrame(vbox)
|
self.fillPlayerFrame(vbox)
|
||||||
playerFrame.add(vbox)
|
playerFrame.add(vbox)
|
||||||
|
self.boxes['player'] = vbox
|
||||||
|
|
||||||
sitesFrame = gtk.Frame("Sites:")
|
sitesFrame = gtk.Frame("Sites:")
|
||||||
sitesFrame.set_label_align(0.0, 0.0)
|
sitesFrame.set_label_align(0.0, 0.0)
|
||||||
|
@ -73,6 +77,7 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
self.fillSitesFrame(vbox)
|
self.fillSitesFrame(vbox)
|
||||||
sitesFrame.add(vbox)
|
sitesFrame.add(vbox)
|
||||||
|
self.boxes['sites'] = vbox
|
||||||
|
|
||||||
# Game types
|
# Game types
|
||||||
gamesFrame = gtk.Frame("Games:")
|
gamesFrame = gtk.Frame("Games:")
|
||||||
|
@ -82,29 +87,29 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
self.fillGamesFrame(vbox)
|
self.fillGamesFrame(vbox)
|
||||||
gamesFrame.add(vbox)
|
gamesFrame.add(vbox)
|
||||||
|
self.boxes['games'] = vbox
|
||||||
|
|
||||||
# Limits
|
# Limits
|
||||||
limitsFrame = gtk.Frame("Limits:")
|
limitsFrame = gtk.Frame()
|
||||||
limitsFrame.set_label_align(0.0, 0.0)
|
|
||||||
limitsFrame.show()
|
limitsFrame.show()
|
||||||
vbox = gtk.VBox(False, 0)
|
vbox = gtk.VBox(False, 0)
|
||||||
self.cbLimits = {}
|
self.cbLimits = {}
|
||||||
self.cbNoLimits = None
|
self.cbNoLimits = None
|
||||||
self.cbAllLimits = None
|
self.cbAllLimits = None
|
||||||
|
|
||||||
self.fillLimitsFrame(vbox, display)
|
self.fillLimitsFrame(vbox, self.display)
|
||||||
limitsFrame.add(vbox)
|
limitsFrame.add(vbox)
|
||||||
|
|
||||||
# Seats
|
# Seats
|
||||||
seatsFrame = gtk.Frame("Seats:")
|
seatsFrame = gtk.Frame()
|
||||||
seatsFrame.set_label_align(0.0, 0.0)
|
|
||||||
seatsFrame.show()
|
seatsFrame.show()
|
||||||
vbox = gtk.VBox(False, 0)
|
vbox = gtk.VBox(False, 0)
|
||||||
self.sbSeats = {}
|
self.sbSeats = {}
|
||||||
|
|
||||||
self.fillSeatsFrame(vbox, display)
|
self.fillSeatsFrame(vbox, self.display)
|
||||||
seatsFrame.add(vbox)
|
seatsFrame.add(vbox)
|
||||||
|
|
||||||
|
# Date
|
||||||
dateFrame = gtk.Frame("Date:")
|
dateFrame = gtk.Frame("Date:")
|
||||||
dateFrame.set_label_align(0.0, 0.0)
|
dateFrame.set_label_align(0.0, 0.0)
|
||||||
dateFrame.show()
|
dateFrame.show()
|
||||||
|
@ -112,11 +117,13 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
self.fillDateFrame(vbox)
|
self.fillDateFrame(vbox)
|
||||||
dateFrame.add(vbox)
|
dateFrame.add(vbox)
|
||||||
|
self.boxes['date'] = vbox
|
||||||
|
|
||||||
|
# Buttons
|
||||||
self.Button1=gtk.Button("Unnamed 1")
|
self.Button1=gtk.Button("Unnamed 1")
|
||||||
|
self.Button1.set_sensitive(False)
|
||||||
|
|
||||||
self.Button2=gtk.Button("Unnamed 2")
|
self.Button2=gtk.Button("Unnamed 2")
|
||||||
#self.exportButton.connect("clicked", self.exportGraph, "show clicked")
|
|
||||||
self.Button2.set_sensitive(False)
|
self.Button2.set_sensitive(False)
|
||||||
|
|
||||||
self.mainVBox.add(playerFrame)
|
self.mainVBox.add(playerFrame)
|
||||||
|
@ -131,21 +138,21 @@ class Filters(threading.Thread):
|
||||||
self.mainVBox.show_all()
|
self.mainVBox.show_all()
|
||||||
|
|
||||||
# Should do this cleaner
|
# Should do this cleaner
|
||||||
if "Heroes" not in display or display["Heroes"] == False:
|
if "Heroes" not in self.display or self.display["Heroes"] == False:
|
||||||
playerFrame.hide()
|
playerFrame.hide()
|
||||||
if "Sites" not in display or display["Sites"] == False:
|
if "Sites" not in self.display or self.display["Sites"] == False:
|
||||||
sitesFrame.hide()
|
sitesFrame.hide()
|
||||||
if "Games" not in display or display["Games"] == False:
|
if "Games" not in self.display or self.display["Games"] == False:
|
||||||
gamesFrame.hide()
|
gamesFrame.hide()
|
||||||
if "Limits" not in display or display["Limits"] == False:
|
if "Limits" not in self.display or self.display["Limits"] == False:
|
||||||
limitsFrame.hide()
|
limitsFrame.hide()
|
||||||
if "Seats" not in display or display["Seats"] == False:
|
if "Seats" not in self.display or self.display["Seats"] == False:
|
||||||
seatsFrame.hide()
|
seatsFrame.hide()
|
||||||
if "Dates" not in display or display["Dates"] == False:
|
if "Dates" not in self.display or self.display["Dates"] == False:
|
||||||
dateFrame.hide()
|
dateFrame.hide()
|
||||||
if "Button1" not in display or display["Button1"] == False:
|
if "Button1" not in self.display or self.display["Button1"] == False:
|
||||||
self.Button1.hide()
|
self.Button1.hide()
|
||||||
if "Button2" not in display or display["Button2"] == False:
|
if "Button2" not in self.display or self.display["Button2"] == False:
|
||||||
self.Button2.hide()
|
self.Button2.hide()
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
|
@ -184,12 +191,14 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
def registerButton1Callback(self, callback):
|
def registerButton1Callback(self, callback):
|
||||||
self.Button1.connect("clicked", callback, "clicked")
|
self.Button1.connect("clicked", callback, "clicked")
|
||||||
|
self.Button1.set_sensitive(True)
|
||||||
|
|
||||||
def registerButton2Name(self, title):
|
def registerButton2Name(self, title):
|
||||||
self.Button2.set_label(title)
|
self.Button2.set_label(title)
|
||||||
|
|
||||||
def registerButton2Callback(self, callback):
|
def registerButton2Callback(self, callback):
|
||||||
self.Button2.connect("clicked", callback, "clicked")
|
self.Button2.connect("clicked", callback, "clicked")
|
||||||
|
self.Button2.set_sensitive(True)
|
||||||
|
|
||||||
def cardCallback(self, widget, data=None):
|
def cardCallback(self, widget, data=None):
|
||||||
print "DEBUG: %s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
|
print "DEBUG: %s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
|
||||||
|
@ -226,7 +235,7 @@ class Filters(threading.Thread):
|
||||||
cb = gtk.CheckButton(str(ltext))
|
cb = gtk.CheckButton(str(ltext))
|
||||||
cb.connect('clicked', self.__set_limit_select, limit)
|
cb.connect('clicked', self.__set_limit_select, limit)
|
||||||
hbox.pack_start(cb, False, False, 0)
|
hbox.pack_start(cb, False, False, 0)
|
||||||
if limit != "None":
|
if limit != "none":
|
||||||
cb.set_active(True)
|
cb.set_active(True)
|
||||||
return(cb)
|
return(cb)
|
||||||
|
|
||||||
|
@ -251,11 +260,11 @@ class Filters(threading.Thread):
|
||||||
else:
|
else:
|
||||||
if self.cbAllLimits != None:
|
if self.cbAllLimits != None:
|
||||||
self.cbAllLimits.set_active(False)
|
self.cbAllLimits.set_active(False)
|
||||||
elif limit == "All":
|
elif limit == "all":
|
||||||
if self.limits[limit]:
|
if self.limits[limit]:
|
||||||
for cb in self.cbLimits.values():
|
for cb in self.cbLimits.values():
|
||||||
cb.set_active(True)
|
cb.set_active(True)
|
||||||
elif limit == "None":
|
elif limit == "none":
|
||||||
if self.limits[limit]:
|
if self.limits[limit]:
|
||||||
for cb in self.cbLimits.values():
|
for cb in self.cbLimits.values():
|
||||||
cb.set_active(False)
|
cb.set_active(False)
|
||||||
|
@ -298,38 +307,66 @@ class Filters(threading.Thread):
|
||||||
print "INFO: No games returned from database"
|
print "INFO: No games returned from database"
|
||||||
|
|
||||||
def fillLimitsFrame(self, vbox, display):
|
def fillLimitsFrame(self, vbox, display):
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
vbox.pack_start(hbox, False, False, 0)
|
||||||
|
lbl_title = gtk.Label(self.filterText['limitstitle'])
|
||||||
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
|
hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
|
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
||||||
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
|
showb.connect('clicked', self.__toggle_box, 'limits')
|
||||||
|
hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
|
||||||
|
vbox1 = gtk.VBox(False, 0)
|
||||||
|
vbox.pack_start(vbox1, False, False, 0)
|
||||||
|
self.boxes['limits'] = vbox1
|
||||||
|
|
||||||
self.cursor.execute(self.sql.query['getLimits'])
|
self.cursor.execute(self.sql.query['getLimits'])
|
||||||
result = self.db.cursor.fetchall()
|
result = self.db.cursor.fetchall()
|
||||||
if len(result) >= 1:
|
if len(result) >= 1:
|
||||||
hbox = gtk.HBox(True, 0)
|
hbox = gtk.HBox(True, 0)
|
||||||
vbox.pack_start(hbox, False, False, 0)
|
vbox1.pack_start(hbox, False, False, 0)
|
||||||
vbox1 = gtk.VBox(False, 0)
|
|
||||||
hbox.pack_start(vbox1, False, False, 0)
|
|
||||||
vbox2 = gtk.VBox(False, 0)
|
vbox2 = gtk.VBox(False, 0)
|
||||||
hbox.pack_start(vbox2, False, False, 0)
|
hbox.pack_start(vbox2, False, False, 0)
|
||||||
|
vbox3 = gtk.VBox(False, 0)
|
||||||
|
hbox.pack_start(vbox3, False, False, 0)
|
||||||
for i, line in enumerate(result):
|
for i, line in enumerate(result):
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
if i <= len(result)/2:
|
if i <= len(result)/2:
|
||||||
vbox1.pack_start(hbox, False, False, 0)
|
|
||||||
else:
|
|
||||||
vbox2.pack_start(hbox, False, False, 0)
|
vbox2.pack_start(hbox, False, False, 0)
|
||||||
|
else:
|
||||||
|
vbox3.pack_start(hbox, False, False, 0)
|
||||||
self.cbLimits[line[0]] = self.createLimitLine(hbox, line[0], line[0])
|
self.cbLimits[line[0]] = self.createLimitLine(hbox, line[0], line[0])
|
||||||
if "LimitSep" in display and display["LimitSep"] == True and len(result) >= 2:
|
if "LimitSep" in display and display["LimitSep"] == True and len(result) >= 2:
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
self.cbAllLimits = self.createLimitLine(hbox, 'all', self.filterText['limitsall'])
|
self.cbAllLimits = self.createLimitLine(hbox, 'all', self.filterText['limitsall'])
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
self.cbNoLimits = self.createLimitLine(hbox, 'none', self.filterText['limitsnone'])
|
self.cbNoLimits = self.createLimitLine(hbox, 'none', self.filterText['limitsnone'])
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
cb = self.createLimitLine(hbox, 'show', self.filterText['limitsshow'])
|
cb = self.createLimitLine(hbox, 'show', self.filterText['limitsshow'])
|
||||||
else:
|
else:
|
||||||
print "INFO: No games returned from database"
|
print "INFO: No games returned from database"
|
||||||
|
|
||||||
def fillSeatsFrame(self, vbox, display):
|
def fillSeatsFrame(self, vbox, display):
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox.pack_start(hbox, False, False, 0)
|
||||||
|
lbl_title = gtk.Label(self.filterText['seatstitle'])
|
||||||
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
|
hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
|
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
||||||
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
|
showb.connect('clicked', self.__toggle_box, 'seats')
|
||||||
|
hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
|
||||||
|
vbox1 = gtk.VBox(False, 0)
|
||||||
|
vbox.pack_start(vbox1, False, False, 0)
|
||||||
|
self.boxes['seats'] = vbox1
|
||||||
|
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
|
|
||||||
lbl_from = gtk.Label(self.filterText['seatsbetween'])
|
lbl_from = gtk.Label(self.filterText['seatsbetween'])
|
||||||
lbl_to = gtk.Label(self.filterText['seatsand'])
|
lbl_to = gtk.Label(self.filterText['seatsand'])
|
||||||
|
@ -338,8 +375,6 @@ class Filters(threading.Thread):
|
||||||
adj2 = gtk.Adjustment(value=10, lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
|
adj2 = gtk.Adjustment(value=10, lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
|
||||||
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
|
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hbox.pack_start(lbl_from, expand=False, padding=3)
|
hbox.pack_start(lbl_from, expand=False, padding=3)
|
||||||
hbox.pack_start(sb1, False, False, 0)
|
hbox.pack_start(sb1, False, False, 0)
|
||||||
hbox.pack_start(lbl_to, expand=False, padding=3)
|
hbox.pack_start(lbl_to, expand=False, padding=3)
|
||||||
|
@ -347,7 +382,7 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
if "SeatSep" in display and display["SeatSep"] == True:
|
if "SeatSep" in display and display["SeatSep"] == True:
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
cb = gtk.CheckButton(self.filterText['seatsshow'])
|
cb = gtk.CheckButton(self.filterText['seatsshow'])
|
||||||
cb.connect('clicked', self.__set_seat_select, 'show')
|
cb.connect('clicked', self.__set_seat_select, 'show')
|
||||||
hbox.pack_start(cb, False, False, 0)
|
hbox.pack_start(cb, False, False, 0)
|
||||||
|
@ -358,8 +393,6 @@ class Filters(threading.Thread):
|
||||||
self.sbSeats['from'] = sb1
|
self.sbSeats['from'] = sb1
|
||||||
self.sbSeats['to'] = sb2
|
self.sbSeats['to'] = sb2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def fillCardsFrame(self, vbox):
|
def fillCardsFrame(self, vbox):
|
||||||
hbox1 = gtk.HBox(True,0)
|
hbox1 = gtk.HBox(True,0)
|
||||||
hbox1.show()
|
hbox1.show()
|
||||||
|
@ -414,6 +447,16 @@ class Filters(threading.Thread):
|
||||||
|
|
||||||
hbox.pack_start(btn_clear, expand=False, padding=15)
|
hbox.pack_start(btn_clear, expand=False, padding=15)
|
||||||
|
|
||||||
|
def __toggle_box(self, widget, entry):
|
||||||
|
if "Limits" not in self.display or self.display["Limits"] == False:
|
||||||
|
self.boxes[entry].hide()
|
||||||
|
elif self.boxes[entry].props.visible:
|
||||||
|
self.boxes[entry].hide()
|
||||||
|
widget.set_label("show")
|
||||||
|
else:
|
||||||
|
self.boxes[entry].show()
|
||||||
|
widget.set_label("hide")
|
||||||
|
|
||||||
def __calendar_dialog(self, widget, entry):
|
def __calendar_dialog(self, widget, entry):
|
||||||
d = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
d = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
d.set_title('Pick a date')
|
d.set_title('Pick a date')
|
||||||
|
|
|
@ -183,37 +183,67 @@ class FpdbSQLQueries:
|
||||||
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||||
handStart DATETIME NOT NULL,
|
handStart DATETIME NOT NULL,
|
||||||
importTime DATETIME NOT NULL,
|
importTime DATETIME NOT NULL,
|
||||||
seats SMALLINT NOT NULL,
|
seats TINYINT NOT NULL,
|
||||||
maxSeats SMALLINT NOT NULL,
|
maxSeats TINYINT NOT NULL,
|
||||||
vpi SMALLINT,
|
boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||||
street0Seen SMALLINT,
|
boardcard2 smallint,
|
||||||
street1Seen SMALLINT,
|
boardcard3 smallint,
|
||||||
street2Seen SMALLINT,
|
boardcard4 smallint,
|
||||||
street3Seen SMALLINT,
|
boardcard5 smallint,
|
||||||
street4Seen SMALLINT,
|
texture smallint,
|
||||||
sdSeen SMALLINT,
|
playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
||||||
|
playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
|
||||||
|
playersAtStreet2 SMALLINT NOT NULL,
|
||||||
|
playersAtStreet3 SMALLINT NOT NULL,
|
||||||
|
playersAtStreet4 SMALLINT NOT NULL,
|
||||||
|
playersAtShowdown SMALLINT NOT NULL,
|
||||||
|
street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
|
||||||
|
street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
|
||||||
|
street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
|
||||||
|
street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
|
||||||
|
street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
|
||||||
|
street1Pot INT, /* pot size at flop/street4 */
|
||||||
|
street2Pot INT, /* pot size at turn/street5 */
|
||||||
|
street3Pot INT, /* pot size at river/street6 */
|
||||||
|
street4Pot INT, /* pot size at sd/street7 */
|
||||||
|
showdownPot INT, /* pot size at sd/street7 */
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
commentTs DATETIME)
|
commentTs DATETIME)
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif(self.dbname == 'PostgreSQL'):
|
elif(self.dbname == 'PostgreSQL'):
|
||||||
self.query['createHandsTable'] = """CREATE TABLE Hands (
|
self.query['createHandsTable'] = """CREATE TABLE Hands (
|
||||||
id BIGSERIAL, PRIMARY KEY (id),
|
id BIGSERIAL, PRIMARY KEY (id),
|
||||||
tableName VARCHAR(20),
|
tableName VARCHAR(20) NOT NULL,
|
||||||
siteHandNo BIGINT,
|
siteHandNo BIGINT NOT NULL,
|
||||||
gametypeId INT, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
gametypeId INT NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||||
handStart timestamp without time zone,
|
handStart timestamp without time zone NOT NULL,
|
||||||
importTime timestamp without time zone,
|
importTime timestamp without time zone NOT NULL,
|
||||||
seats SMALLINT,
|
seats SMALLINT NOT NULL,
|
||||||
maxSeats SMALLINT,
|
maxSeats SMALLINT NOT NULL,
|
||||||
vpi SMALLINT,
|
boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||||
street0Seen SMALLINT,
|
boardcard2 smallint,
|
||||||
street1Seen SMALLINT,
|
boardcard3 smallint,
|
||||||
street2Seen SMALLINT,
|
boardcard4 smallint,
|
||||||
street3Seen SMALLINT,
|
boardcard5 smallint,
|
||||||
street4Seen SMALLINT,
|
texture smallint,
|
||||||
sdSeen SMALLINT,
|
playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
||||||
comment TEXT,
|
playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
|
||||||
commentTs timestamp without time zone)"""
|
playersAtStreet2 SMALLINT NOT NULL,
|
||||||
|
playersAtStreet3 SMALLINT NOT NULL,
|
||||||
|
playersAtStreet4 SMALLINT NOT NULL,
|
||||||
|
playersAtShowdown SMALLINT NOT NULL,
|
||||||
|
street0Raises SMALLINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
|
||||||
|
street1Raises SMALLINT NOT NULL, /* num small bets paid to see turn/street5 */
|
||||||
|
street2Raises SMALLINT NOT NULL, /* num big bets paid to see river/street6 */
|
||||||
|
street3Raises SMALLINT NOT NULL, /* num big bets paid to see sd/street7 */
|
||||||
|
street4Raises SMALLINT NOT NULL, /* num big bets paid to see showdown */
|
||||||
|
street1Pot INT, /* pot size at flop/street4 */
|
||||||
|
street2Pot INT, /* pot size at turn/street5 */
|
||||||
|
street3Pot INT, /* pot size at river/street6 */
|
||||||
|
street4Pot INT, /* pot size at sd/street7 */
|
||||||
|
showdownPot INT, /* pot size at sd/street7 */
|
||||||
|
comment TEXT,
|
||||||
|
commentTs timestamp without time zone)"""
|
||||||
elif(self.dbname == 'SQLite'):
|
elif(self.dbname == 'SQLite'):
|
||||||
self.query['createHandsTable'] = """ """
|
self.query['createHandsTable'] = """ """
|
||||||
|
|
||||||
|
@ -321,20 +351,13 @@ class FpdbSQLQueries:
|
||||||
position CHAR(1),
|
position CHAR(1),
|
||||||
seatNo SMALLINT NOT NULL,
|
seatNo SMALLINT NOT NULL,
|
||||||
|
|
||||||
card1Value smallint NOT NULL,
|
card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||||
card1Suit char(1) NOT NULL,
|
card2 smallint NOT NULL,
|
||||||
card2Value smallint NOT NULL,
|
card3 smallint,
|
||||||
card2Suit char(1) NOT NULL,
|
card4 smallint,
|
||||||
card3Value smallint,
|
card5 smallint,
|
||||||
card3Suit char(1),
|
card6 smallint,
|
||||||
card4Value smallint,
|
card7 smallint,
|
||||||
card4Suit char(1),
|
|
||||||
card5Value smallint,
|
|
||||||
card5Suit char(1),
|
|
||||||
card6Value smallint,
|
|
||||||
card6Suit char(1),
|
|
||||||
card7Value smallint,
|
|
||||||
card7Suit char(1),
|
|
||||||
startCards smallint,
|
startCards smallint,
|
||||||
|
|
||||||
ante INT,
|
ante INT,
|
||||||
|
@ -417,6 +440,24 @@ class FpdbSQLQueries:
|
||||||
street4CheckCallRaiseChance BOOLEAN NOT NULL,
|
street4CheckCallRaiseChance BOOLEAN NOT NULL,
|
||||||
street4CheckCallRaiseDone BOOLEAN NOT NULL,
|
street4CheckCallRaiseDone BOOLEAN NOT NULL,
|
||||||
|
|
||||||
|
street0Calls TINYINT,
|
||||||
|
street1Calls TINYINT,
|
||||||
|
street2Calls TINYINT,
|
||||||
|
street3Calls TINYINT,
|
||||||
|
street4Calls TINYINT,
|
||||||
|
street0Bets TINYINT,
|
||||||
|
street1Bets TINYINT,
|
||||||
|
street2Bets TINYINT,
|
||||||
|
street3Bets TINYINT,
|
||||||
|
street4Bets TINYINT,
|
||||||
|
street0Raises TINYINT,
|
||||||
|
street1Raises TINYINT,
|
||||||
|
street2Raises TINYINT,
|
||||||
|
street3Raises TINYINT,
|
||||||
|
street4Raises TINYINT,
|
||||||
|
|
||||||
|
actionString VARCHAR(15),
|
||||||
|
|
||||||
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))
|
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif(self.dbname == 'PostgreSQL'):
|
elif(self.dbname == 'PostgreSQL'):
|
||||||
|
@ -428,20 +469,13 @@ class FpdbSQLQueries:
|
||||||
position CHAR(1),
|
position CHAR(1),
|
||||||
seatNo SMALLINT NOT NULL,
|
seatNo SMALLINT NOT NULL,
|
||||||
|
|
||||||
card1Value smallint NOT NULL,
|
card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
|
||||||
card1Suit char(1) NOT NULL,
|
card2 smallint NOT NULL,
|
||||||
card2Value smallint NOT NULL,
|
card3 smallint,
|
||||||
card2Suit char(1) NOT NULL,
|
card4 smallint,
|
||||||
card3Value smallint,
|
card5 smallint,
|
||||||
card3Suit char(1),
|
card6 smallint,
|
||||||
card4Value smallint,
|
card7 smallint,
|
||||||
card4Suit char(1),
|
|
||||||
card5Value smallint,
|
|
||||||
card5Suit char(1),
|
|
||||||
card6Value smallint,
|
|
||||||
card6Suit char(1),
|
|
||||||
card7Value smallint,
|
|
||||||
card7Suit char(1),
|
|
||||||
startCards smallint,
|
startCards smallint,
|
||||||
|
|
||||||
ante INT,
|
ante INT,
|
||||||
|
@ -524,6 +558,24 @@ class FpdbSQLQueries:
|
||||||
street4CheckCallRaiseChance BOOLEAN NOT NULL,
|
street4CheckCallRaiseChance BOOLEAN NOT NULL,
|
||||||
street4CheckCallRaiseDone BOOLEAN NOT NULL,
|
street4CheckCallRaiseDone BOOLEAN NOT NULL,
|
||||||
|
|
||||||
|
street0Calls SMALLINT,
|
||||||
|
street1Calls SMALLINT,
|
||||||
|
street2Calls SMALLINT,
|
||||||
|
street3Calls SMALLINT,
|
||||||
|
street4Calls SMALLINT,
|
||||||
|
street0Bets SMALLINT,
|
||||||
|
street1Bets SMALLINT,
|
||||||
|
street2Bets SMALLINT,
|
||||||
|
street3Bets SMALLINT,
|
||||||
|
street4Bets SMALLINT,
|
||||||
|
street0Raises SMALLINT,
|
||||||
|
street1Raises SMALLINT,
|
||||||
|
street2Raises SMALLINT,
|
||||||
|
street3Raises SMALLINT,
|
||||||
|
street4Raises SMALLINT,
|
||||||
|
|
||||||
|
actionString VARCHAR(15),
|
||||||
|
|
||||||
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
|
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
|
||||||
elif(self.dbname == 'SQLite'):
|
elif(self.dbname == 'SQLite'):
|
||||||
self.query['createHandsPlayersTable'] = """ """
|
self.query['createHandsPlayersTable'] = """ """
|
||||||
|
@ -674,7 +726,24 @@ class FpdbSQLQueries:
|
||||||
street3CheckCallRaiseChance INT NOT NULL,
|
street3CheckCallRaiseChance INT NOT NULL,
|
||||||
street3CheckCallRaiseDone INT NOT NULL,
|
street3CheckCallRaiseDone INT NOT NULL,
|
||||||
street4CheckCallRaiseChance INT NOT NULL,
|
street4CheckCallRaiseChance INT NOT NULL,
|
||||||
street4CheckCallRaiseDone INT NOT NULL)
|
street4CheckCallRaiseDone INT NOT NULL,
|
||||||
|
|
||||||
|
street0Calls INT,
|
||||||
|
street1Calls INT,
|
||||||
|
street2Calls INT,
|
||||||
|
street3Calls INT,
|
||||||
|
street4Calls INT,
|
||||||
|
street0Bets INT,
|
||||||
|
street1Bets INT,
|
||||||
|
street2Bets INT,
|
||||||
|
street3Bets INT,
|
||||||
|
street4Bets INT,
|
||||||
|
street0Raises INT,
|
||||||
|
street1Raises INT,
|
||||||
|
street2Raises INT,
|
||||||
|
street3Raises INT,
|
||||||
|
street4Raises INT)
|
||||||
|
|
||||||
ENGINE=INNODB"""
|
ENGINE=INNODB"""
|
||||||
elif(self.dbname == 'PostgreSQL'):
|
elif(self.dbname == 'PostgreSQL'):
|
||||||
self.query['createHudCacheTable'] = """CREATE TABLE HudCache (
|
self.query['createHudCacheTable'] = """CREATE TABLE HudCache (
|
||||||
|
@ -756,7 +825,24 @@ class FpdbSQLQueries:
|
||||||
street3CheckCallRaiseChance INT,
|
street3CheckCallRaiseChance INT,
|
||||||
street3CheckCallRaiseDone INT,
|
street3CheckCallRaiseDone INT,
|
||||||
street4CheckCallRaiseChance INT,
|
street4CheckCallRaiseChance INT,
|
||||||
street4CheckCallRaiseDone INT)"""
|
street4CheckCallRaiseDone INT,
|
||||||
|
|
||||||
|
street0Calls INT,
|
||||||
|
street1Calls INT,
|
||||||
|
street2Calls INT,
|
||||||
|
street3Calls INT,
|
||||||
|
street4Calls INT,
|
||||||
|
street0Bets INT,
|
||||||
|
street1Bets INT,
|
||||||
|
street2Bets INT,
|
||||||
|
street3Bets INT,
|
||||||
|
street4Bets INT,
|
||||||
|
street0Raises INT,
|
||||||
|
street1Raises INT,
|
||||||
|
street2Raises INT,
|
||||||
|
street3Raises INT,
|
||||||
|
street4Raises INT)
|
||||||
|
"""
|
||||||
elif(self.dbname == 'SQLite'):
|
elif(self.dbname == 'SQLite'):
|
||||||
self.query['createHudCacheTable'] = """ """
|
self.query['createHudCacheTable'] = """ """
|
||||||
|
|
||||||
|
@ -867,6 +953,8 @@ class FpdbSQLQueries:
|
||||||
where hp.playerId in <player_test>
|
where hp.playerId in <player_test>
|
||||||
and hp.tourneysPlayersId IS NULL
|
and hp.tourneysPlayersId IS NULL
|
||||||
and h.seats <seats_test>
|
and h.seats <seats_test>
|
||||||
|
<flagtest>
|
||||||
|
<gtbigBlind_test>
|
||||||
group by hgameTypeId
|
group by hgameTypeId
|
||||||
,hp.playerId
|
,hp.playerId
|
||||||
,gt.base
|
,gt.base
|
||||||
|
@ -878,6 +966,8 @@ class FpdbSQLQueries:
|
||||||
,gt.base
|
,gt.base
|
||||||
,gt.category
|
,gt.category
|
||||||
<orderbyseats>
|
<orderbyseats>
|
||||||
|
<orderbyhgameTypeId>
|
||||||
|
,maxbigblind desc
|
||||||
,upper(gt.limitType)
|
,upper(gt.limitType)
|
||||||
,s.name
|
,s.name
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -20,7 +20,9 @@ import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk
|
import gtk
|
||||||
import os
|
import os
|
||||||
|
from time import time, strftime
|
||||||
|
|
||||||
|
import Card
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
import fpdb_db
|
import fpdb_db
|
||||||
import Filters
|
import Filters
|
||||||
|
@ -47,6 +49,10 @@ class GuiPlayerStats (threading.Thread):
|
||||||
settings.update(config.get_import_parameters())
|
settings.update(config.get_import_parameters())
|
||||||
settings.update(config.get_default_paths())
|
settings.update(config.get_default_paths())
|
||||||
|
|
||||||
|
# text used on screen stored here so that it can be configured
|
||||||
|
self.filterText = {'handhead':'Hand Breakdown for all levels listed above'
|
||||||
|
}
|
||||||
|
|
||||||
filters_display = { "Heroes" : True,
|
filters_display = { "Heroes" : True,
|
||||||
"Sites" : True,
|
"Sites" : True,
|
||||||
"Games" : False,
|
"Games" : False,
|
||||||
|
@ -55,65 +61,93 @@ class GuiPlayerStats (threading.Thread):
|
||||||
"Seats" : True,
|
"Seats" : True,
|
||||||
"SeatSep" : True,
|
"SeatSep" : True,
|
||||||
"Dates" : False,
|
"Dates" : False,
|
||||||
|
"Groups" : True,
|
||||||
"Button1" : True,
|
"Button1" : True,
|
||||||
"Button2" : False
|
"Button2" : True
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, settings, config, querylist, display = filters_display)
|
self.filters = Filters.Filters(self.db, settings, config, querylist, display = filters_display)
|
||||||
self.filters.registerButton1Name("Refresh")
|
self.filters.registerButton1Name("_Filters")
|
||||||
self.filters.registerButton1Callback(self.refreshStats)
|
self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
|
self.filters.registerButton2Name("_Refresh")
|
||||||
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
# TODO: these probably be a dict keyed on colAlias and the headings loop should use colAlias ...
|
# ToDo: store in config
|
||||||
# This could be stored in config eventually, or maybe configured in this window somehow.
|
# ToDo: create popup to adjust column config
|
||||||
# Each colAlias element is the name of a column returned by the sql
|
# columns to display, keys match column name returned by sql, values in tuple are:
|
||||||
# query (in lower case) and each colHeads element is the text to use as
|
# is column displayed, column heading, xalignment, formatting
|
||||||
# the heading in the GUI. Both sequences should be the same length.
|
self.columns = [ ("game", True, "Game", 0.0, "%s")
|
||||||
# To miss columns out remove them from both tuples (the 1st 2 elements should always be included).
|
, ("hand", False, "Hand", 0.0, "%s") # true not allowed for this line
|
||||||
# To change the heading just edit the second list element as required
|
, ("n", True, "Hds", 1.0, "%d")
|
||||||
# If the first list element does not match a query column that pair is ignored
|
, ("avgseats", True, "Seats", 1.0, "%3.1f")
|
||||||
self.colAlias = ( "game", "n", "avgseats", "vpip", "pfr", "pf3", "steals"
|
, ("vpip", True, "VPIP", 1.0, "%3.1f")
|
||||||
, "saw_f", "sawsd", "wtsdwsf", "wmsd", "flafq", "tuafq", "rvafq"
|
, ("pfr", True, "PFR", 1.0, "%3.1f")
|
||||||
, "pofafq", "net", "bbper100", "rake", "variance"
|
, ("pf3", True, "PF3", 1.0, "%3.1f")
|
||||||
)
|
, ("steals", True, "Steals", 1.0, "%3.1f")
|
||||||
self.colHeads = ( "Game", "Hds", "Seats", "VPIP", "PFR", "PF3", "Steals"
|
, ("saw_f", True, "Saw_F", 1.0, "%3.1f")
|
||||||
, "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq"
|
, ("sawsd", True, "SawSD", 1.0, "%3.1f")
|
||||||
, "PoFAFq", "Net($)", "BB/100", "Rake($)", "Variance"
|
, ("wtsdwsf", True, "WtSDwsF", 1.0, "%3.1f")
|
||||||
)
|
, ("wmsd", True, "W$SD", 1.0, "%3.1f")
|
||||||
self.colXAligns = ( 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
, ("flafq", True, "FlAFq", 1.0, "%3.1f")
|
||||||
, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
, ("tuafq", True, "TuAFq", 1.0, "%3.1f")
|
||||||
, 1.0, 1.0, 1.0, 1.0, 1.0
|
, ("rvafq", True, "RvAFq", 1.0, "%3.1f")
|
||||||
)
|
, ("pofafq", False, "PoFAFq", 1.0, "%3.1f")
|
||||||
self.colFormats = ( "%s", "%d", "%3.1f", "%3.1f", "%3.1f", "%3.1f", "%3.1f"
|
, ("net", True, "Net($)", 1.0, "%6.2f")
|
||||||
, "%3.1f", "%3.1f", "%3.1f", "%3.1f", "%3.1f", "%3.1f", "%3.1f"
|
, ("bbper100", True, "BB/100", 1.0, "%4.2f")
|
||||||
, "%3.1f", "%6.2f", "%4.2f", "%6.2f", "%5.2f"
|
, ("rake", True, "Rake($)", 1.0, "%6.2f")
|
||||||
)
|
, ("variance", True, "Variance", 1.0, "%5.2f")
|
||||||
|
]
|
||||||
|
|
||||||
|
# Detail filters: This holds the data used in the popup window, extra values are
|
||||||
|
# added at the end of these lists during processing
|
||||||
|
# sql test, screen description, min, max
|
||||||
|
self.handtests = [ # already in filter class : ['h.seats', 'Number of Players', 2, 10]
|
||||||
|
['h.maxSeats', 'Size of Table', 2, 10]
|
||||||
|
,['h.playersVpi', 'Players who VPI', 0, 10]
|
||||||
|
,['h.playersAtStreet1', 'Players at Flop', 0, 10]
|
||||||
|
,['h.playersAtStreet2', 'Players at Turn', 0, 10]
|
||||||
|
,['h.playersAtStreet3', 'Players at River', 0, 10]
|
||||||
|
,['h.playersAtStreet4', 'Players at Street7', 0, 10]
|
||||||
|
,['h.playersAtShowdown', 'Players at Showdown', 0, 10]
|
||||||
|
,['h.street0Raises', 'Bets to See Flop', 0, 5]
|
||||||
|
,['h.street1Raises', 'Bets to See Turn', 0, 5]
|
||||||
|
,['h.street2Raises', 'Bets to See River', 0, 5]
|
||||||
|
,['h.street3Raises', 'Bets to See Street7', 0, 5]
|
||||||
|
,['h.street4Raises', 'Bets to See Showdown', 0, 5]
|
||||||
|
]
|
||||||
|
|
||||||
self.stat_table = None
|
|
||||||
self.stats_frame = None
|
self.stats_frame = None
|
||||||
|
self.stats_vbox = None
|
||||||
|
self.detailFilters = [] # the data used to enhance the sql select
|
||||||
|
|
||||||
self.main_hbox = gtk.HBox(False, 0)
|
self.main_hbox = gtk.HBox(False, 0)
|
||||||
self.main_hbox.show()
|
self.main_hbox.show()
|
||||||
|
|
||||||
statsFrame = gtk.Frame("Stats:")
|
self.stats_frame = gtk.Frame()
|
||||||
statsFrame.set_label_align(0.0, 0.0)
|
|
||||||
statsFrame.show()
|
|
||||||
self.stats_frame = gtk.VBox(False, 0)
|
|
||||||
self.stats_frame.show()
|
self.stats_frame.show()
|
||||||
|
|
||||||
self.fillStatsFrame(self.stats_frame)
|
self.stats_vbox = gtk.VBox(False, 0)
|
||||||
statsFrame.add(self.stats_frame)
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
self.fillStatsFrame(self.stats_vbox)
|
||||||
|
|
||||||
self.main_hbox.pack_start(self.filters.get_vbox())
|
self.main_hbox.pack_start(self.filters.get_vbox())
|
||||||
self.main_hbox.pack_start(statsFrame)
|
self.main_hbox.pack_start(self.stats_frame, expand=True, fill=True)
|
||||||
|
|
||||||
|
# make sure Hand column is not displayed
|
||||||
|
[x for x in self.columns if x[0] == 'hand'][0][1] == False
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
return self.main_hbox
|
return self.main_hbox
|
||||||
|
|
||||||
def refreshStats(self, widget, data):
|
def refreshStats(self, widget, data):
|
||||||
try: self.stats_table.destroy()
|
try: self.stats_vbox.destroy()
|
||||||
except AttributeError: pass
|
except AttributeError: pass
|
||||||
self.fillStatsFrame(self.stats_frame)
|
self.stats_vbox = gtk.VBox(False, 0)
|
||||||
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
self.fillStatsFrame(self.stats_vbox)
|
||||||
|
|
||||||
def fillStatsFrame(self, vbox):
|
def fillStatsFrame(self, vbox):
|
||||||
sites = self.filters.getSites()
|
sites = self.filters.getSites()
|
||||||
|
@ -147,72 +181,137 @@ class GuiPlayerStats (threading.Thread):
|
||||||
self.createStatsTable(vbox, playerids, sitenos, limits, seats)
|
self.createStatsTable(vbox, playerids, sitenos, limits, seats)
|
||||||
|
|
||||||
def createStatsTable(self, vbox, playerids, sitenos, limits, seats):
|
def createStatsTable(self, vbox, playerids, sitenos, limits, seats):
|
||||||
|
starttime = time()
|
||||||
|
|
||||||
|
# Display summary table at top of page
|
||||||
|
# 3rd parameter passes extra flags, currently includes:
|
||||||
|
# holecards - whether to display card breakdown (True/False)
|
||||||
|
flags = [False]
|
||||||
|
self.addTable(vbox, 'playerDetailedStats', flags, playerids, sitenos, limits, seats)
|
||||||
|
|
||||||
|
# Separator
|
||||||
|
sep = gtk.HSeparator()
|
||||||
|
vbox.pack_start(sep, expand=False, padding=3)
|
||||||
|
sep.show_now()
|
||||||
|
vbox.show_now()
|
||||||
|
heading = gtk.Label(self.filterText['handhead'])
|
||||||
|
heading.show()
|
||||||
|
vbox.pack_start(heading, expand=False, padding=3)
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
vbox.pack_start(swin, expand=True, padding=3)
|
||||||
|
|
||||||
|
vbox1 = gtk.VBox(False, 0)
|
||||||
|
vbox1.show()
|
||||||
|
swin.add_with_viewport(vbox1)
|
||||||
|
|
||||||
|
# Detailed table
|
||||||
|
flags = [True]
|
||||||
|
self.addTable(vbox1, 'playerDetailedStats', flags, playerids, sitenos, limits, seats)
|
||||||
|
|
||||||
|
self.db.db.commit()
|
||||||
|
print "Stats page displayed in %4.2f seconds" % (time() - starttime)
|
||||||
|
#end def fillStatsFrame(self, vbox):
|
||||||
|
|
||||||
|
def addTable(self, vbox, query, flags, playerids, sitenos, limits, seats):
|
||||||
|
row = 0
|
||||||
|
sqlrow = 0
|
||||||
|
colalias,colshow,colheading,colxalign,colformat = 0,1,2,3,4
|
||||||
|
if not flags: holecards = False
|
||||||
|
else: holecards = flags[0]
|
||||||
|
|
||||||
|
|
||||||
self.stats_table = gtk.Table(1, 1, False)
|
self.stats_table = gtk.Table(1, 1, False)
|
||||||
self.stats_table.set_col_spacings(4)
|
self.stats_table.set_col_spacings(4)
|
||||||
self.stats_table.show()
|
self.stats_table.show()
|
||||||
vbox.add(self.stats_table)
|
|
||||||
|
|
||||||
# Create header row
|
tmp = self.sql.query[query]
|
||||||
row = 0
|
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, seats)
|
||||||
col = 0
|
|
||||||
for t in self.colHeads:
|
|
||||||
l = gtk.Label(self.colHeads[col])
|
|
||||||
l.set_alignment(xalign=self.colXAligns[col], yalign=0.5)
|
|
||||||
l.show()
|
|
||||||
self.stats_table.attach(l, col, col+1, row, row+1, yoptions=gtk.SHRINK)
|
|
||||||
col +=1
|
|
||||||
|
|
||||||
tmp = self.sql.query['playerDetailedStats']
|
|
||||||
tmp = self.refineQuery(tmp, playerids, sitenos, limits, seats)
|
|
||||||
self.cursor.execute(tmp)
|
self.cursor.execute(tmp)
|
||||||
result = self.cursor.fetchall()
|
result = self.cursor.fetchall()
|
||||||
|
|
||||||
#cols = 19
|
|
||||||
rows = len(result) # +1 for title row
|
|
||||||
colnames = [desc[0].lower() for desc in self.cursor.description]
|
colnames = [desc[0].lower() for desc in self.cursor.description]
|
||||||
|
|
||||||
col = 0
|
# pre-fetch some constant values:
|
||||||
for row in range(rows):
|
cols_to_show = [x for x in self.columns if x[colshow]]
|
||||||
|
hgametypeid_idx = colnames.index('hgametypeid')
|
||||||
|
|
||||||
|
liststore = gtk.ListStore(*([str] * len(cols_to_show)))
|
||||||
|
view = gtk.TreeView(model=liststore)
|
||||||
|
view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
|
||||||
|
vbox.pack_start(view, expand=False, padding=3)
|
||||||
|
textcell = gtk.CellRendererText()
|
||||||
|
numcell = gtk.CellRendererText()
|
||||||
|
numcell.set_property('xalign', 1.0)
|
||||||
|
listcols = []
|
||||||
|
|
||||||
|
# Create header row eg column: ("game", True, "Game", 0.0, "%s")
|
||||||
|
for col, column in enumerate(cols_to_show):
|
||||||
|
if column[colalias] == 'game' and holecards:
|
||||||
|
s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
|
||||||
|
else:
|
||||||
|
s = column[colheading]
|
||||||
|
listcols.append(gtk.TreeViewColumn(s))
|
||||||
|
view.append_column(listcols[col])
|
||||||
|
if column[colformat] == '%s':
|
||||||
|
if col == 1 and holecards:
|
||||||
|
listcols[col].pack_start(textcell, expand=True)
|
||||||
|
else:
|
||||||
|
listcols[col].pack_start(textcell, expand=False)
|
||||||
|
listcols[col].add_attribute(textcell, 'text', col)
|
||||||
|
else:
|
||||||
|
listcols[col].pack_start(numcell, expand=False)
|
||||||
|
listcols[col].add_attribute(numcell, 'text', col)
|
||||||
|
|
||||||
|
rows = len(result) # +1 for title row
|
||||||
|
|
||||||
|
while sqlrow < rows:
|
||||||
|
treerow = []
|
||||||
if(row%2 == 0):
|
if(row%2 == 0):
|
||||||
bgcolor = "white"
|
bgcolor = "white"
|
||||||
else:
|
else:
|
||||||
bgcolor = "lightgrey"
|
bgcolor = "lightgrey"
|
||||||
for col,colname in enumerate(self.colAlias):
|
for col,column in enumerate(cols_to_show):
|
||||||
if colname in colnames:
|
if column[colalias] in colnames:
|
||||||
value = result[row][colnames.index(colname)]
|
value = result[sqlrow][colnames.index(column[colalias])]
|
||||||
else:
|
else:
|
||||||
if colname == 'game':
|
if column[colalias] == 'game':
|
||||||
minbb = result[row][colnames.index('minbigblind')]
|
if holecards:
|
||||||
maxbb = result[row][colnames.index('maxbigblind')]
|
value = Card.twoStartCardString( result[sqlrow][hgametypeid_idx] )
|
||||||
value = result[row][colnames.index('limittype')] + ' ' \
|
|
||||||
+ result[row][colnames.index('category')].title() + ' ' \
|
|
||||||
+ result[row][colnames.index('name')] + ' $'
|
|
||||||
if 100 * int(minbb/100.0) != minbb:
|
|
||||||
value += '%.2f' % (minbb/100.0)
|
|
||||||
else:
|
else:
|
||||||
value += '%.0f' % (minbb/100.0)
|
minbb = result[sqlrow][colnames.index('minbigblind')]
|
||||||
if minbb != maxbb:
|
maxbb = result[sqlrow][colnames.index('maxbigblind')]
|
||||||
if 100 * int(maxbb/100.0) != maxbb:
|
value = result[sqlrow][colnames.index('limittype')] + ' ' \
|
||||||
value += ' - $' + '%.2f' % (maxbb/100.0)
|
+ result[sqlrow][colnames.index('category')].title() + ' ' \
|
||||||
|
+ result[sqlrow][colnames.index('name')] + ' $'
|
||||||
|
if 100 * int(minbb/100.0) != minbb:
|
||||||
|
value += '%.2f' % (minbb/100.0)
|
||||||
else:
|
else:
|
||||||
value += ' - $' + '%.0f' % (maxbb/100.0)
|
value += '%.0f' % (minbb/100.0)
|
||||||
|
if minbb != maxbb:
|
||||||
|
if 100 * int(maxbb/100.0) != maxbb:
|
||||||
|
value += ' - $' + '%.2f' % (maxbb/100.0)
|
||||||
|
else:
|
||||||
|
value += ' - $' + '%.0f' % (maxbb/100.0)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
eb = gtk.EventBox()
|
|
||||||
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
|
||||||
if value and value != -999:
|
if value and value != -999:
|
||||||
l = gtk.Label(self.colFormats[col] % value)
|
treerow.append(column[colformat] % value)
|
||||||
else:
|
else:
|
||||||
l = gtk.Label(' ')
|
treerow.append(' ')
|
||||||
l.set_alignment(xalign=self.colXAligns[col], yalign=0.5)
|
iter = liststore.append(treerow)
|
||||||
eb.add(l)
|
sqlrow += 1
|
||||||
self.stats_table.attach(eb, col, col+1, row+1, row+2, yoptions=gtk.SHRINK)
|
row += 1
|
||||||
l.show()
|
vbox.show_all()
|
||||||
eb.show()
|
|
||||||
self.db.db.commit()
|
#end def addTable(self, query, vars, playerids, sitenos, limits, seats):
|
||||||
#end def fillStatsFrame(self, vbox):
|
|
||||||
|
def refineQuery(self, query, flags, playerids, sitenos, limits, seats):
|
||||||
|
if not flags: holecards = False
|
||||||
|
else: holecards = flags[0]
|
||||||
|
|
||||||
def refineQuery(self, query, playerids, sitenos, limits, seats):
|
|
||||||
if playerids:
|
if playerids:
|
||||||
nametest = str(tuple(playerids))
|
nametest = str(tuple(playerids))
|
||||||
nametest = nametest.replace("L", "")
|
nametest = nametest.replace("L", "")
|
||||||
|
@ -238,20 +337,32 @@ class GuiPlayerStats (threading.Thread):
|
||||||
blindtest = str(tuple([x for x in limits if str(x).isdigit()]))
|
blindtest = str(tuple([x for x in limits if str(x).isdigit()]))
|
||||||
blindtest = blindtest.replace("L", "")
|
blindtest = blindtest.replace("L", "")
|
||||||
blindtest = blindtest.replace(",)",")")
|
blindtest = blindtest.replace(",)",")")
|
||||||
query = query.replace("<gtbigBlind_test>", "gt.bigBlind in " + blindtest)
|
query = query.replace("<gtbigBlind_test>", " and gt.bigBlind in " + blindtest + " ")
|
||||||
else:
|
else:
|
||||||
query = query.replace("<gtbigBlind_test>", "gt.bigBlind = -1 ")
|
query = query.replace("<gtbigBlind_test>", "")
|
||||||
|
|
||||||
groupLevels = "show" not in str(limits)
|
if holecards: # pinch level variables for hole card query
|
||||||
if groupLevels:
|
query = query.replace("<hgameTypeId>", "hp.startcards")
|
||||||
query = query.replace("<groupbygt.bigBlind>", "")
|
query = query.replace("<orderbyhgameTypeId>", ",hgameTypeId desc")
|
||||||
query = query.replace("<hcgametypeId>", "-1")
|
|
||||||
query = query.replace("<hgameTypeId>", "-1")
|
|
||||||
else:
|
else:
|
||||||
query = query.replace("<groupbygt.bigBlind>", ",gt.bigBlind")
|
query = query.replace("<orderbyhgameTypeId>", "")
|
||||||
query = query.replace("<hcgametypeId>", "hc.gametypeId")
|
groupLevels = "show" not in str(limits)
|
||||||
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
if groupLevels:
|
||||||
|
query = query.replace("<hgameTypeId>", "-1")
|
||||||
|
else:
|
||||||
|
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||||
|
|
||||||
|
# process self.detailFilters (a list of tuples)
|
||||||
|
flagtest = ''
|
||||||
|
#self.detailFilters = [('h.seats', 5, 6)] # for debug
|
||||||
|
if self.detailFilters:
|
||||||
|
for f in self.detailFilters:
|
||||||
|
if len(f) == 3:
|
||||||
|
# X between Y and Z
|
||||||
|
flagtest += ' and %s between %s and %s ' % (f[0], str(f[1]), str(f[2]))
|
||||||
|
query = query.replace("<flagtest>", flagtest)
|
||||||
|
|
||||||
|
# allow for differences in sql cast() function:
|
||||||
if self.db.backend == self.MYSQL_INNODB:
|
if self.db.backend == self.MYSQL_INNODB:
|
||||||
query = query.replace("<signed>", 'signed ')
|
query = query.replace("<signed>", 'signed ')
|
||||||
else:
|
else:
|
||||||
|
@ -260,3 +371,70 @@ class GuiPlayerStats (threading.Thread):
|
||||||
#print "query =\n", query
|
#print "query =\n", query
|
||||||
return(query)
|
return(query)
|
||||||
#end def refineQuery(self, query, playerids, sitenos, limits):
|
#end def refineQuery(self, query, playerids, sitenos, limits):
|
||||||
|
|
||||||
|
def showDetailFilter(self, widget, data):
|
||||||
|
detailDialog = gtk.Dialog(title="Detailed Filters", parent=self.main_window
|
||||||
|
,flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT
|
||||||
|
,buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
|
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
|
||||||
|
|
||||||
|
handbox = gtk.VBox(True, 0)
|
||||||
|
detailDialog.vbox.pack_start(handbox, False, False, 0)
|
||||||
|
handbox.show()
|
||||||
|
|
||||||
|
label = gtk.Label("Hand Filters:")
|
||||||
|
handbox.add(label)
|
||||||
|
label.show()
|
||||||
|
|
||||||
|
betweenFilters = []
|
||||||
|
for htest in self.handtests:
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
handbox.pack_start(hbox, False, False, 0)
|
||||||
|
hbox.show()
|
||||||
|
|
||||||
|
cb = gtk.CheckButton()
|
||||||
|
lbl_from = gtk.Label(htest[1])
|
||||||
|
lbl_from.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
|
lbl_tween = gtk.Label('between')
|
||||||
|
lbl_to = gtk.Label('and')
|
||||||
|
adj1 = gtk.Adjustment(value=htest[2], lower=0, upper=10, step_incr=1, page_incr=1, page_size=0)
|
||||||
|
sb1 = gtk.SpinButton(adjustment=adj1, climb_rate=0.0, digits=0)
|
||||||
|
adj2 = gtk.Adjustment(value=htest[3], lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
|
||||||
|
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
|
||||||
|
|
||||||
|
for df in [x for x in self.detailFilters if x[0] == htest[0]]:
|
||||||
|
cb.set_active(True)
|
||||||
|
|
||||||
|
hbox.pack_start(cb, expand=False, padding=3)
|
||||||
|
hbox.pack_start(lbl_from, expand=True, padding=3)
|
||||||
|
hbox.pack_start(lbl_tween, expand=False, padding=3)
|
||||||
|
hbox.pack_start(sb1, False, False, 0)
|
||||||
|
hbox.pack_start(lbl_to, expand=False, padding=3)
|
||||||
|
hbox.pack_start(sb2, False, False, 0)
|
||||||
|
|
||||||
|
cb.show()
|
||||||
|
lbl_from.show()
|
||||||
|
lbl_tween.show()
|
||||||
|
sb1.show()
|
||||||
|
lbl_to.show()
|
||||||
|
sb2.show()
|
||||||
|
|
||||||
|
htest[4:7] = [cb,sb1,sb2]
|
||||||
|
|
||||||
|
response = detailDialog.run()
|
||||||
|
|
||||||
|
if response == gtk.RESPONSE_ACCEPT:
|
||||||
|
self.detailFilters = []
|
||||||
|
for ht in self.handtests:
|
||||||
|
if ht[4].get_active():
|
||||||
|
self.detailFilters.append( (ht[0], ht[5].get_value_as_int(), ht[6].get_value_as_int()) )
|
||||||
|
ht[2],ht[3] = ht[5].get_value_as_int(), ht[6].get_value_as_int()
|
||||||
|
print "detailFilters =", self.detailFilters
|
||||||
|
self.refreshStats(None, None)
|
||||||
|
|
||||||
|
detailDialog.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -349,13 +349,13 @@ class Sql:
|
||||||
select
|
select
|
||||||
seatNo AS seat_number,
|
seatNo AS seat_number,
|
||||||
name AS screen_name,
|
name AS screen_name,
|
||||||
card1Value, card1Suit,
|
card1, /*card1Value, card1Suit, */
|
||||||
card2Value, card2Suit,
|
card2, /*card2Value, card2Suit, */
|
||||||
card3Value, card3Suit,
|
card3, /*card3Value, card3Suit, */
|
||||||
card4Value, card4Suit,
|
card4, /*card4Value, card4Suit, */
|
||||||
card5Value, card5Suit,
|
card5, /*card5Value, card5Suit, */
|
||||||
card6Value, card6Suit,
|
card6, /*card6Value, card6Suit, */
|
||||||
card7Value, card7Suit
|
card7 /*card7Value, card7Suit */
|
||||||
from HandsPlayers, Players
|
from HandsPlayers, Players
|
||||||
where handID = %s and HandsPlayers.playerId = Players.id
|
where handID = %s and HandsPlayers.playerId = Players.id
|
||||||
order by seatNo
|
order by seatNo
|
||||||
|
|
|
@ -82,11 +82,11 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no,
|
||||||
t2 = time()
|
t2 = time()
|
||||||
|
|
||||||
hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
|
hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
|
||||||
,hand_start_time, names, tableName, maxSeats)
|
,hand_start_time, names, tableName, maxSeats, hudImportData)
|
||||||
t3 = time()
|
t3 = time()
|
||||||
hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha(
|
hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha(
|
||||||
backend, db, cursor, category, hands_id, player_ids, start_cashes
|
backend, db, cursor, category, hands_id, player_ids, start_cashes
|
||||||
, positions, card_values, card_suits, winnings, rakes, seatNos)
|
, positions, card_values, card_suits, winnings, rakes, seatNos, hudImportData)
|
||||||
t4 = time()
|
t4 = time()
|
||||||
#print "ring holdem, backend=%d" % backend
|
#print "ring holdem, backend=%d" % backend
|
||||||
if fastStoreHudCache:
|
if fastStoreHudCache:
|
||||||
|
|
|
@ -21,6 +21,8 @@ import datetime
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import Card
|
||||||
|
|
||||||
PS = 1
|
PS = 1
|
||||||
FTP = 2
|
FTP = 2
|
||||||
|
|
||||||
|
@ -1448,14 +1450,29 @@ card5Value, card5Suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
|
||||||
#end def store_board_cards
|
#end def store_board_cards
|
||||||
|
|
||||||
def storeHands(backend, conn, cursor, site_hand_no, gametype_id
|
def storeHands(backend, conn, cursor, site_hand_no, gametype_id
|
||||||
,hand_start_time, names, tableName, maxSeats):
|
,hand_start_time, names, tableName, maxSeats, hudCache):
|
||||||
#stores into table hands
|
#stores into table hands:
|
||||||
cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats, tableName, importTime, maxSeats) VALUES (%s, %s, %s, %s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names), tableName, datetime.datetime.today(), maxSeats))
|
cursor.execute ("""INSERT INTO Hands
|
||||||
#todo: find a better way of doing this...
|
(siteHandNo, gametypeId, handStart, seats, tableName, importTime, maxSeats
|
||||||
#cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
|
,playersVpi, playersAtStreet1, playersAtStreet2
|
||||||
#return cursor.fetchall()[0][0]
|
,playersAtStreet3, playersAtStreet4, playersAtShowdown
|
||||||
|
,street0Raises, street1Raises, street2Raises
|
||||||
|
,street3Raises, street4Raises, street1Pot
|
||||||
|
,street2Pot, street3Pot, street4Pot
|
||||||
|
,showdownPot
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||||
|
"""
|
||||||
|
, (site_hand_no, gametype_id, hand_start_time, len(names), tableName, datetime.datetime.today(), maxSeats
|
||||||
|
,hudCache['playersVpi'], hudCache['playersAtStreet1'], hudCache['playersAtStreet2']
|
||||||
|
,hudCache['playersAtStreet3'], hudCache['playersAtStreet4'], hudCache['playersAtShowdown']
|
||||||
|
,hudCache['street0Raises'], hudCache['street1Raises'], hudCache['street2Raises']
|
||||||
|
,hudCache['street3Raises'], hudCache['street4Raises'], hudCache['street1Pot']
|
||||||
|
,hudCache['street2Pot'], hudCache['street3Pot'], hudCache['street4Pot']
|
||||||
|
,hudCache['showdownPot']
|
||||||
|
))
|
||||||
return getLastInsertId(backend, conn, cursor)
|
return getLastInsertId(backend, conn, cursor)
|
||||||
#return db.insert_id() # mysql only
|
|
||||||
#end def storeHands
|
#end def storeHands
|
||||||
|
|
||||||
def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id, player_ids, start_cashes
|
def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id, player_ids, start_cashes
|
||||||
|
@ -1474,14 +1491,13 @@ def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id,
|
||||||
|
|
||||||
if (category=="holdem"):
|
if (category=="holdem"):
|
||||||
for i in xrange(len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
x,y = card_values[i][0],card_values[i][1]
|
startCards = Card.twoStartCards(card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1])
|
||||||
if (card_suits[i][0] == card_suits[i][1] and x < y) or (card_suits[i][0] != card_suits[i][1] and x > y):
|
card1 = Card.cardFromValueSuit(card_values[i][0], card_suits[i][0])
|
||||||
x,y = y,x
|
card2 = Card.cardFromValueSuit(card_values[i][1], card_suits[i][1])
|
||||||
startCards = 13 * (x-2) + (y-2)
|
|
||||||
cursor.execute ("""
|
cursor.execute ("""
|
||||||
INSERT INTO HandsPlayers
|
INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
|
(handId, playerId, startCash, position, tourneyTypeId,
|
||||||
card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo, totalProfit,
|
card1, card2, startCards, winnings, rake, seatNo, totalProfit,
|
||||||
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
|
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
|
||||||
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
|
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
|
||||||
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
|
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
|
||||||
|
@ -1494,13 +1510,16 @@ INSERT INTO HandsPlayers
|
||||||
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
|
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
|
||||||
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
|
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
|
||||||
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
|
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
|
||||||
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone
|
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone,
|
||||||
|
street0Calls, street1Calls, street2Calls, street3Calls, street4Calls,
|
||||||
|
street0Bets, street1Bets, street2Bets, street3Bets, street4Bets
|
||||||
)
|
)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
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, %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, %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, %s, %s, %s, %s, %s,
|
||||||
(hands_id, player_ids[i], start_cashes[i], positions[i], len(player_ids), 1, # tourneytypeid
|
%s, %s, %s, %s, %s, %s, %s, %s)""",
|
||||||
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
|
(hands_id, player_ids[i], start_cashes[i], positions[i], 1, # tourneytypeid
|
||||||
|
card1, card2, startCards,
|
||||||
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
|
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
|
||||||
hudCache['street0VPI'][i], hudCache['street0Aggr'][i],
|
hudCache['street0VPI'][i], hudCache['street0Aggr'][i],
|
||||||
hudCache['street0_3BChance'][i], hudCache['street0_3BDone'][i],
|
hudCache['street0_3BChance'][i], hudCache['street0_3BDone'][i],
|
||||||
|
@ -1523,7 +1542,9 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
||||||
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
|
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
|
||||||
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
|
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
|
||||||
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
|
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
|
||||||
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i]
|
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i],
|
||||||
|
hudCache['street0Calls'][i], hudCache['street1Calls'][i], hudCache['street2Calls'][i], hudCache['street3Calls'][i], hudCache['street4Calls'][i],
|
||||||
|
hudCache['street0Bets'][i], hudCache['street1Bets'][i], hudCache['street2Bets'][i], hudCache['street3Bets'][i], hudCache['street4Bets'][i]
|
||||||
) )
|
) )
|
||||||
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
|
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
|
||||||
#result.append(cursor.fetchall()[0][0])
|
#result.append(cursor.fetchall()[0][0])
|
||||||
|
@ -1531,7 +1552,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
||||||
elif (category=="omahahi" or category=="omahahilo"):
|
elif (category=="omahahi" or category=="omahahilo"):
|
||||||
for i in xrange(len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute ("""INSERT INTO HandsPlayers
|
cursor.execute ("""INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
|
(handId, playerId, startCash, position, tourneyTypeId,
|
||||||
card1Value, card1Suit, card2Value, card2Suit,
|
card1Value, card1Suit, card2Value, card2Suit,
|
||||||
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo, totalProfit,
|
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo, totalProfit,
|
||||||
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
|
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
|
||||||
|
@ -1546,12 +1567,15 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
||||||
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
|
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
|
||||||
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
|
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
|
||||||
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
|
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
|
||||||
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone
|
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone,
|
||||||
|
street0Calls, street1Calls, street2Calls, street3Calls, street4Calls,
|
||||||
|
street0Bets, street1Bets, street2Bets, street3Bets, street4Bets
|
||||||
)
|
)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
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, %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, %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, %s, %s, %s, %s, %s, %s,
|
||||||
(hands_id, player_ids[i], start_cashes[i], positions[i], len(player_ids), 1, # tourneytypeid
|
%s, %s, %s, %s, %s, %s, %s, %s)""",
|
||||||
|
(hands_id, player_ids[i], start_cashes[i], positions[i], 1, # tourneytypeid
|
||||||
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
|
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
|
||||||
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
|
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
|
||||||
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
|
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
|
||||||
|
@ -1576,7 +1600,9 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
|
||||||
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
|
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
|
||||||
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
|
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
|
||||||
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
|
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
|
||||||
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i]
|
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i],
|
||||||
|
hudCache['street0Calls'][i], hudCache['street1Calls'][i], hudCache['street2Calls'][i], hudCache['street3Calls'][i], hudCache['street4Calls'][i],
|
||||||
|
hudCache['street0Bets'][i], hudCache['street1Bets'][i], hudCache['street2Bets'][i], hudCache['street3Bets'][i], hudCache['street4Bets'][i]
|
||||||
) )
|
) )
|
||||||
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
|
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
|
||||||
#result.append(cursor.fetchall()[0][0])
|
#result.append(cursor.fetchall()[0][0])
|
||||||
|
@ -1705,6 +1731,41 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
stealAttempted=[]
|
stealAttempted=[]
|
||||||
hudDataPositions=[]
|
hudDataPositions=[]
|
||||||
|
|
||||||
|
street0Calls=[]
|
||||||
|
street1Calls=[]
|
||||||
|
street2Calls=[]
|
||||||
|
street3Calls=[]
|
||||||
|
street4Calls=[]
|
||||||
|
street0Bets=[]
|
||||||
|
street1Bets=[]
|
||||||
|
street2Bets=[]
|
||||||
|
street3Bets=[]
|
||||||
|
street4Bets=[]
|
||||||
|
#street0Raises=[]
|
||||||
|
#street1Raises=[]
|
||||||
|
#street2Raises=[]
|
||||||
|
#street3Raises=[]
|
||||||
|
#street4Raises=[]
|
||||||
|
|
||||||
|
# Summary figures for hand table:
|
||||||
|
result={}
|
||||||
|
result['playersVpi']=0
|
||||||
|
result['playersAtStreet1']=0
|
||||||
|
result['playersAtStreet2']=0
|
||||||
|
result['playersAtStreet3']=0
|
||||||
|
result['playersAtStreet4']=0
|
||||||
|
result['playersAtShowdown']=0
|
||||||
|
result['street0Raises']=0
|
||||||
|
result['street1Raises']=0
|
||||||
|
result['street2Raises']=0
|
||||||
|
result['street3Raises']=0
|
||||||
|
result['street4Raises']=0
|
||||||
|
result['street1Pot']=0
|
||||||
|
result['street2Pot']=0
|
||||||
|
result['street3Pot']=0
|
||||||
|
result['street4Pot']=0
|
||||||
|
result['showdownPot']=0
|
||||||
|
|
||||||
firstPfRaiseByNo=-1
|
firstPfRaiseByNo=-1
|
||||||
firstPfRaiserId=-1
|
firstPfRaiserId=-1
|
||||||
firstPfRaiserNo=-1
|
firstPfRaiserNo=-1
|
||||||
|
@ -1776,6 +1837,21 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
myWonAtSD=0.0
|
myWonAtSD=0.0
|
||||||
myStealAttemptChance=False
|
myStealAttemptChance=False
|
||||||
myStealAttempted=False
|
myStealAttempted=False
|
||||||
|
myStreet0Calls=0
|
||||||
|
myStreet1Calls=0
|
||||||
|
myStreet2Calls=0
|
||||||
|
myStreet3Calls=0
|
||||||
|
myStreet4Calls=0
|
||||||
|
myStreet0Bets=0
|
||||||
|
myStreet1Bets=0
|
||||||
|
myStreet2Bets=0
|
||||||
|
myStreet3Bets=0
|
||||||
|
myStreet4Bets=0
|
||||||
|
#myStreet0Raises=0
|
||||||
|
#myStreet1Raises=0
|
||||||
|
#myStreet2Raises=0
|
||||||
|
#myStreet3Raises=0
|
||||||
|
#myStreet4Raises=0
|
||||||
|
|
||||||
#calculate VPIP and PFR
|
#calculate VPIP and PFR
|
||||||
street=0
|
street=0
|
||||||
|
@ -1786,6 +1862,13 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if currentAction == "bet" or currentAction == "call":
|
if currentAction == "bet" or currentAction == "call":
|
||||||
myStreet0VPI = True
|
myStreet0VPI = True
|
||||||
|
|
||||||
|
if myStreet0VPI:
|
||||||
|
result['playersVpi'] += 1
|
||||||
|
myStreet0Calls = action_types[street][player].count('call')
|
||||||
|
myStreet0Bets = action_types[street][player].count('bet')
|
||||||
|
# street0Raises = action_types[street][player].count('raise') bet count includes raises for now
|
||||||
|
result['street0Raises'] += myStreet0Bets
|
||||||
|
|
||||||
#PF3BChance and PF3B
|
#PF3BChance and PF3B
|
||||||
pfFold=-1
|
pfFold=-1
|
||||||
pfRaise=-1
|
pfRaise=-1
|
||||||
|
@ -1866,6 +1949,16 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if any(actiontype == "fold" for actiontype in action_types[4][player]):
|
if any(actiontype == "fold" for actiontype in action_types[4][player]):
|
||||||
mySawShowdown = False
|
mySawShowdown = False
|
||||||
|
|
||||||
|
if myStreet1Seen:
|
||||||
|
result['playersAtStreet1'] += 1
|
||||||
|
if myStreet2Seen:
|
||||||
|
result['playersAtStreet2'] += 1
|
||||||
|
if myStreet3Seen:
|
||||||
|
result['playersAtStreet3'] += 1
|
||||||
|
if myStreet4Seen:
|
||||||
|
result['playersAtStreet4'] += 1
|
||||||
|
if mySawShowdown:
|
||||||
|
result['playersAtShowdown'] += 1
|
||||||
|
|
||||||
#flop stuff
|
#flop stuff
|
||||||
street=1
|
street=1
|
||||||
|
@ -1873,6 +1966,11 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
||||||
myStreet1Aggr = True
|
myStreet1Aggr = True
|
||||||
|
|
||||||
|
myStreet1Calls = action_types[street][player].count('call')
|
||||||
|
myStreet1Bets = action_types[street][player].count('bet')
|
||||||
|
# street1Raises = action_types[street][player].count('raise') bet count includes raises for now
|
||||||
|
result['street1Raises'] += myStreet1Bets
|
||||||
|
|
||||||
for otherPlayer in xrange(len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
|
@ -1890,6 +1988,11 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
||||||
myStreet2Aggr = True
|
myStreet2Aggr = True
|
||||||
|
|
||||||
|
myStreet2Calls = action_types[street][player].count('call')
|
||||||
|
myStreet2Bets = action_types[street][player].count('bet')
|
||||||
|
# street2Raises = action_types[street][player].count('raise') bet count includes raises for now
|
||||||
|
result['street2Raises'] += myStreet2Bets
|
||||||
|
|
||||||
for otherPlayer in xrange(len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
|
@ -1907,6 +2010,11 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
||||||
myStreet3Aggr = True
|
myStreet3Aggr = True
|
||||||
|
|
||||||
|
myStreet3Calls = action_types[street][player].count('call')
|
||||||
|
myStreet3Bets = action_types[street][player].count('bet')
|
||||||
|
# street3Raises = action_types[street][player].count('raise') bet count includes raises for now
|
||||||
|
result['street3Raises'] += myStreet3Bets
|
||||||
|
|
||||||
for otherPlayer in xrange(len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
|
@ -1924,6 +2032,11 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
if any(actiontype == "bet" for actiontype in action_types[street][player]):
|
||||||
myStreet4Aggr=True
|
myStreet4Aggr=True
|
||||||
|
|
||||||
|
myStreet4Calls = action_types[street][player].count('call')
|
||||||
|
myStreet4Bets = action_types[street][player].count('bet')
|
||||||
|
# street4Raises = action_types[street][player].count('raise') bet count includes raises for now
|
||||||
|
result['street4Raises'] += myStreet4Bets
|
||||||
|
|
||||||
for otherPlayer in xrange(len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
|
@ -1990,8 +2103,24 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
#todo: stud positions and steals
|
#todo: stud positions and steals
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
street0Calls.append(myStreet0Calls)
|
||||||
|
street1Calls.append(myStreet1Calls)
|
||||||
|
street2Calls.append(myStreet2Calls)
|
||||||
|
street3Calls.append(myStreet3Calls)
|
||||||
|
street4Calls.append(myStreet4Calls)
|
||||||
|
street0Bets.append(myStreet0Bets)
|
||||||
|
street1Bets.append(myStreet1Bets)
|
||||||
|
street2Bets.append(myStreet2Bets)
|
||||||
|
street3Bets.append(myStreet3Bets)
|
||||||
|
street4Bets.append(myStreet4Bets)
|
||||||
|
#street0Raises.append(myStreet0Raises)
|
||||||
|
#street1Raises.append(myStreet1Raises)
|
||||||
|
#street2Raises.append(myStreet2Raises)
|
||||||
|
#street3Raises.append(myStreet3Raises)
|
||||||
|
#street4Raises.append(myStreet4Raises)
|
||||||
|
|
||||||
#add each array to the to-be-returned dictionary
|
#add each array to the to-be-returned dictionary
|
||||||
result={'street0VPI':street0VPI}
|
result['street0VPI']=street0VPI
|
||||||
result['street0Aggr']=street0Aggr
|
result['street0Aggr']=street0Aggr
|
||||||
result['street0_3BChance']=street0_3BChance
|
result['street0_3BChance']=street0_3BChance
|
||||||
result['street0_3BDone']=street0_3BDone
|
result['street0_3BDone']=street0_3BDone
|
||||||
|
@ -2017,6 +2146,21 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
result['wonAtSD']=wonAtSD
|
result['wonAtSD']=wonAtSD
|
||||||
result['stealAttemptChance']=stealAttemptChance
|
result['stealAttemptChance']=stealAttemptChance
|
||||||
result['stealAttempted']=stealAttempted
|
result['stealAttempted']=stealAttempted
|
||||||
|
result['street0Calls']=street0Calls
|
||||||
|
result['street1Calls']=street1Calls
|
||||||
|
result['street2Calls']=street2Calls
|
||||||
|
result['street3Calls']=street3Calls
|
||||||
|
result['street4Calls']=street4Calls
|
||||||
|
result['street0Bets']=street0Bets
|
||||||
|
result['street1Bets']=street1Bets
|
||||||
|
result['street2Bets']=street2Bets
|
||||||
|
result['street3Bets']=street3Bets
|
||||||
|
result['street4Bets']=street4Bets
|
||||||
|
#result['street0Raises']=street0Raises
|
||||||
|
#result['street1Raises']=street1Raises
|
||||||
|
#result['street2Raises']=street2Raises
|
||||||
|
#result['street3Raises']=street3Raises
|
||||||
|
#result['street4Raises']=street4Raises
|
||||||
|
|
||||||
#now the various steal values
|
#now the various steal values
|
||||||
foldBbToStealChance=[]
|
foldBbToStealChance=[]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user