Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql
This commit is contained in:
commit
f6016c1c0e
|
@ -431,6 +431,11 @@ class Database:
|
|||
|
||||
if hud_style == 'S' or h_hud_style == 'S':
|
||||
self.get_stats_from_hand_session(hand, stat_dict, hero_id, hud_style, h_hud_style)
|
||||
try:
|
||||
print "Session: hero_id =", hero_id, "hds =", stat_dict[hero_id]['n']
|
||||
except:
|
||||
pass
|
||||
|
||||
if hud_style == 'S' and h_hud_style == 'S':
|
||||
return stat_dict
|
||||
|
||||
|
@ -452,7 +457,7 @@ class Database:
|
|||
#elif h_hud_style == 'H':
|
||||
# h_stylekey = date_nhands_ago needs array by player here ...
|
||||
|
||||
#if aggregate: always use aggreagte query now: use agg_bb_mult of 1 for no aggregation:
|
||||
#if aggregate: always use aggregate query now: use agg_bb_mult of 1 for no aggregation:
|
||||
query = 'get_stats_from_hand_aggregated'
|
||||
subs = (hand, hero_id, stylekey, agg_bb_mult, agg_bb_mult, hero_id, h_stylekey, h_agg_bb_mult, h_agg_bb_mult)
|
||||
print "agg query subs:", subs
|
||||
|
@ -474,6 +479,10 @@ class Database:
|
|||
t_dict[name.lower()] = val
|
||||
# print t_dict
|
||||
stat_dict[t_dict['player_id']] = t_dict
|
||||
try:
|
||||
print "get_stats end: hero_id =", hero_id, "hds =", stat_dict[hero_id]['n']
|
||||
except:
|
||||
pass
|
||||
|
||||
return stat_dict
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ class Filters(threading.Thread):
|
|||
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Number of _Players'
|
||||
,'limitstitle':'Limits:', 'seatstitle':'Number of Players:'
|
||||
,'groupstitle':'Grouping:', 'posnshow':'Show Position Stats:'
|
||||
,'limitsFL':'FL', 'limitsNL':'NL', 'ring':'Ring', 'tour':'Tourney'
|
||||
}
|
||||
|
||||
# For use in date ranges.
|
||||
|
@ -98,6 +99,11 @@ class Filters(threading.Thread):
|
|||
self.cbLimits = {}
|
||||
self.cbNoLimits = None
|
||||
self.cbAllLimits = None
|
||||
self.cbFL = None
|
||||
self.cbNL = None
|
||||
self.rb = {} # radio buttons for ring/tour
|
||||
self.type = None # ring/tour
|
||||
self.types = {} # list of all ring/tour values
|
||||
|
||||
self.fillLimitsFrame(vbox, self.display)
|
||||
limitsFrame.add(vbox)
|
||||
|
@ -190,6 +196,9 @@ class Filters(threading.Thread):
|
|||
ltuple.append(l)
|
||||
return ltuple
|
||||
|
||||
def getType(self):
|
||||
return(self.type)
|
||||
|
||||
def getSeats(self):
|
||||
if 'from' in self.sbSeats:
|
||||
self.seats['from'] = self.sbSeats['from'].get_value_as_int()
|
||||
|
@ -279,21 +288,99 @@ class Filters(threading.Thread):
|
|||
#print w.get_active()
|
||||
self.limits[limit] = w.get_active()
|
||||
print "self.limit[%s] set to %s" %(limit, self.limits[limit])
|
||||
if str(limit).isdigit():
|
||||
if limit.isdigit() or (len(limit) > 2 and limit[-2:] == 'nl'):
|
||||
if self.limits[limit]:
|
||||
if self.cbNoLimits != None:
|
||||
self.cbNoLimits.set_active(False)
|
||||
else:
|
||||
if self.cbAllLimits != None:
|
||||
self.cbAllLimits.set_active(False)
|
||||
if not self.limits[limit]:
|
||||
if limit.isdigit():
|
||||
self.cbFL.set_active(False)
|
||||
else:
|
||||
self.cbNL.set_active(False)
|
||||
elif limit == "all":
|
||||
if self.limits[limit]:
|
||||
for cb in self.cbLimits.values():
|
||||
cb.set_active(True)
|
||||
#for cb in self.cbLimits.values():
|
||||
# cb.set_active(True)
|
||||
if self.cbFL != None:
|
||||
self.cbFL.set_active(True)
|
||||
if self.cbNL != None:
|
||||
self.cbNL.set_active(True)
|
||||
elif limit == "none":
|
||||
if self.limits[limit]:
|
||||
for cb in self.cbLimits.values():
|
||||
cb.set_active(False)
|
||||
self.cbNL.set_active(False)
|
||||
self.cbFL.set_active(False)
|
||||
elif limit == "fl":
|
||||
if not self.limits[limit]:
|
||||
# only toggle all fl limits off if they are all currently on
|
||||
# this stops turning one off from cascading into 'fl' box off
|
||||
# and then all fl limits being turned off
|
||||
all_fl_on = True
|
||||
for cb in self.cbLimits.values():
|
||||
t = cb.get_children()[0].get_text()
|
||||
if t.isdigit():
|
||||
if not cb.get_active():
|
||||
all_fl_on = False
|
||||
found = {'ring':False, 'tour':False}
|
||||
for cb in self.cbLimits.values():
|
||||
#print "cb label: ", cb.children()[0].get_text()
|
||||
t = cb.get_children()[0].get_text()
|
||||
if t.isdigit():
|
||||
if self.limits[limit] or all_fl_on:
|
||||
cb.set_active(self.limits[limit])
|
||||
found[self.types[t]] = True
|
||||
if self.limits[limit]:
|
||||
if not found[self.type]:
|
||||
if self.type == 'ring':
|
||||
if 'tour' in self.rb:
|
||||
self.rb['tour'].set_active(True)
|
||||
elif self.type == 'tour':
|
||||
if 'ring' in self.rb:
|
||||
self.rb['ring'].set_active(True)
|
||||
elif limit == "nl":
|
||||
if not self.limits[limit]:
|
||||
# only toggle all nl limits off if they are all currently on
|
||||
# this stops turning one off from cascading into 'nl' box off
|
||||
# and then all nl limits being turned off
|
||||
all_nl_on = True
|
||||
for cb in self.cbLimits.values():
|
||||
t = cb.get_children()[0].get_text()
|
||||
if "nl" in t and len(t) > 2:
|
||||
if not cb.get_active():
|
||||
all_nl_on = False
|
||||
found = {'ring':False, 'tour':False}
|
||||
for cb in self.cbLimits.values():
|
||||
t = cb.get_children()[0].get_text()
|
||||
if "nl" in t and len(t) > 2:
|
||||
if self.limits[limit] or all_nl_on:
|
||||
cb.set_active(self.limits[limit])
|
||||
found[self.types[t]] = True
|
||||
if self.limits[limit]:
|
||||
if not found[self.type]:
|
||||
if self.type == 'ring':
|
||||
self.rb['tour'].set_active(True)
|
||||
elif self.type == 'tour':
|
||||
self.rb['ring'].set_active(True)
|
||||
elif limit == "ring":
|
||||
print "set", limit, "to", self.limits[limit]
|
||||
if self.limits[limit]:
|
||||
self.type = "ring"
|
||||
for cb in self.cbLimits.values():
|
||||
#print "cb label: ", cb.children()[0].get_text()
|
||||
if self.types[cb.get_children()[0].get_text()] == 'tour':
|
||||
cb.set_active(False)
|
||||
elif limit == "tour":
|
||||
print "set", limit, "to", self.limits[limit]
|
||||
if self.limits[limit]:
|
||||
self.type = "tour"
|
||||
for cb in self.cbLimits.values():
|
||||
#print "cb label: ", cb.children()[0].get_text()
|
||||
if self.types[cb.get_children()[0].get_text()] == 'ring':
|
||||
cb.set_active(False)
|
||||
|
||||
def __set_seat_select(self, w, seat):
|
||||
#print "__set_seat_select: seat =", seat, "active =", w.get_active()
|
||||
|
@ -338,22 +425,23 @@ class Filters(threading.Thread):
|
|||
print "INFO: No games returned from database"
|
||||
|
||||
def fillLimitsFrame(self, vbox, display):
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox.pack_start(hbox, False, False, 0)
|
||||
top_hbox = gtk.HBox(False, 0)
|
||||
vbox.pack_start(top_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)
|
||||
top_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['getLimits2'])
|
||||
# selects limitType, bigBlind
|
||||
result = self.db.cursor.fetchall()
|
||||
fl, nl = False, False
|
||||
if len(result) >= 1:
|
||||
hbox = gtk.HBox(True, 0)
|
||||
vbox1.pack_start(hbox, False, False, 0)
|
||||
|
@ -361,26 +449,69 @@ class Filters(threading.Thread):
|
|||
hbox.pack_start(vbox2, False, False, 0)
|
||||
vbox3 = gtk.VBox(False, 0)
|
||||
hbox.pack_start(vbox3, False, False, 0)
|
||||
found = {'nl':False, 'fl':False, 'ring':False, 'tour':False}
|
||||
for i, line in enumerate(result):
|
||||
hbox = gtk.HBox(False, 0)
|
||||
if i <= len(result)/2:
|
||||
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])
|
||||
if line[1] == 'fl':
|
||||
name = str(line[2])
|
||||
found['fl'] = True
|
||||
else:
|
||||
name = str(line[2])+line[1]
|
||||
found['nl'] = True
|
||||
self.cbLimits[name] = self.createLimitLine(hbox, name, name)
|
||||
self.types[name] = line[0]
|
||||
found[line[0]] = True # type is ring/tour
|
||||
self.type = line[0] # if only one type, set it now
|
||||
if "LimitSep" in display and display["LimitSep"] == True and len(result) >= 2:
|
||||
hbox = gtk.HBox(True, 0)
|
||||
vbox1.pack_start(hbox, False, False, 0)
|
||||
vbox2 = gtk.VBox(False, 0)
|
||||
hbox.pack_start(vbox2, False, False, 0)
|
||||
vbox3 = gtk.VBox(False, 0)
|
||||
hbox.pack_start(vbox3, False, False, 0)
|
||||
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
vbox2.pack_start(hbox, False, False, 0)
|
||||
self.cbAllLimits = self.createLimitLine(hbox, 'all', self.filterText['limitsall'])
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
vbox2.pack_start(hbox, False, False, 0)
|
||||
self.cbNoLimits = self.createLimitLine(hbox, 'none', self.filterText['limitsnone'])
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
cb = self.createLimitLine(hbox, 'show', self.filterText['limitsshow'])
|
||||
|
||||
dest = vbox3 # for ring/tour buttons
|
||||
if "LimitType" in display and display["LimitType"] == True and found['nl'] and found['fl']:
|
||||
#if found['fl']:
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox3.pack_start(hbox, False, False, 0)
|
||||
self.cbFL = self.createLimitLine(hbox, 'fl', self.filterText['limitsFL'])
|
||||
#if found['nl']:
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox3.pack_start(hbox, False, False, 0)
|
||||
self.cbNL = self.createLimitLine(hbox, 'nl', self.filterText['limitsNL'])
|
||||
dest = vbox2 # for ring/tour buttons
|
||||
else:
|
||||
print "INFO: No games returned from database"
|
||||
|
||||
if "Type" in display and display["Type"] == True and found['ring'] and found['tour']:
|
||||
rb1 = gtk.RadioButton(None, self.filterText['ring'])
|
||||
rb1.connect('clicked', self.__set_limit_select, 'ring')
|
||||
rb2 = gtk.RadioButton(rb1, self.filterText['tour'])
|
||||
rb2.connect('clicked', self.__set_limit_select, 'tour')
|
||||
top_hbox.pack_start(rb1, False, False, 0) # (child, expand, fill, padding)
|
||||
top_hbox.pack_start(rb2, True, True, 0) # child uses expand space if fill is true
|
||||
|
||||
self.rb['ring'] = rb1
|
||||
self.rb['tour'] = rb2
|
||||
#print "about to set ring to true"
|
||||
rb1.set_active(True)
|
||||
# set_active doesn't seem to call this for some reason so call manually:
|
||||
self.__set_limit_select(rb1, 'ring')
|
||||
self.type = 'ring'
|
||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||
|
||||
def fillSeatsFrame(self, vbox, display):
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox.pack_start(hbox, False, False, 0)
|
||||
|
@ -411,15 +542,6 @@ class Filters(threading.Thread):
|
|||
hbox.pack_start(lbl_to, expand=False, padding=3)
|
||||
hbox.pack_start(sb2, False, False, 0)
|
||||
|
||||
if "SeatSep" in display and display["SeatSep"] == True:
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
cb = gtk.CheckButton(self.filterText['seatsshow'])
|
||||
cb.connect('clicked', self.__set_seat_select, 'show')
|
||||
hbox.pack_start(cb, False, False, 0)
|
||||
self.sbSeats['show'] = cb
|
||||
self.seats['show'] = False
|
||||
|
||||
self.sbSeats['from'] = sb1
|
||||
self.sbSeats['to'] = sb2
|
||||
|
||||
|
@ -439,14 +561,26 @@ class Filters(threading.Thread):
|
|||
self.boxes['groups'] = vbox1
|
||||
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
vbox1.pack_start(hbox, False, False, 0)
|
||||
cb = self.createLimitLine(hbox, 'show', self.filterText['limitsshow'])
|
||||
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
cb = gtk.CheckButton(self.filterText['posnshow'])
|
||||
cb.connect('clicked', self.__set_group_select, 'posn')
|
||||
hbox.pack_start(cb, False, False, 0)
|
||||
self.sbGroups['posn'] = cb
|
||||
self.groups['posn'] = False
|
||||
|
||||
if "SeatSep" in display and display["SeatSep"] == True:
|
||||
hbox = gtk.HBox(False, 0)
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
cb = gtk.CheckButton(self.filterText['seatsshow'])
|
||||
cb.connect('clicked', self.__set_seat_select, 'show')
|
||||
hbox.pack_start(cb, False, False, 0)
|
||||
self.sbSeats['show'] = cb
|
||||
self.seats['show'] = False
|
||||
|
||||
def fillCardsFrame(self, vbox):
|
||||
hbox1 = gtk.HBox(True,0)
|
||||
hbox1.show()
|
||||
|
|
|
@ -54,17 +54,19 @@ class GuiPlayerStats (threading.Thread):
|
|||
self.filterText = {'handhead':'Hand Breakdown for all levels listed above'
|
||||
}
|
||||
|
||||
filters_display = { "Heroes" : True,
|
||||
"Sites" : True,
|
||||
"Games" : False,
|
||||
"Limits" : True,
|
||||
"LimitSep" : True,
|
||||
"Seats" : True,
|
||||
"SeatSep" : True,
|
||||
"Dates" : True,
|
||||
"Groups" : True,
|
||||
"Button1" : True,
|
||||
"Button2" : True
|
||||
filters_display = { "Heroes" : True,
|
||||
"Sites" : True,
|
||||
"Games" : False,
|
||||
"Limits" : True,
|
||||
"LimitSep" : True,
|
||||
"LimitType" : True,
|
||||
"Type" : True,
|
||||
"Seats" : True,
|
||||
"SeatSep" : True,
|
||||
"Dates" : True,
|
||||
"Groups" : True,
|
||||
"Button1" : True,
|
||||
"Button2" : True
|
||||
}
|
||||
|
||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
||||
|
@ -157,6 +159,7 @@ class GuiPlayerStats (threading.Thread):
|
|||
heroes = self.filters.getHeroes()
|
||||
siteids = self.filters.getSiteIds()
|
||||
limits = self.filters.getLimits()
|
||||
type = self.filters.getType()
|
||||
seats = self.filters.getSeats()
|
||||
groups = self.filters.getGroups()
|
||||
dates = self.filters.getDates()
|
||||
|
@ -185,16 +188,16 @@ class GuiPlayerStats (threading.Thread):
|
|||
print "No limits found"
|
||||
return
|
||||
|
||||
self.createStatsTable(vbox, playerids, sitenos, limits, seats, groups, dates)
|
||||
self.createStatsTable(vbox, playerids, sitenos, limits, type, seats, groups, dates)
|
||||
|
||||
def createStatsTable(self, vbox, playerids, sitenos, limits, seats, groups, dates):
|
||||
def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates):
|
||||
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, groups, dates)
|
||||
self.addTable(vbox, 'playerDetailedStats', flags, playerids, sitenos, limits, type, seats, groups, dates)
|
||||
|
||||
# Separator
|
||||
sep = gtk.HSeparator()
|
||||
|
@ -217,13 +220,13 @@ class GuiPlayerStats (threading.Thread):
|
|||
|
||||
# Detailed table
|
||||
flags = [True]
|
||||
self.addTable(vbox1, 'playerDetailedStats', flags, playerids, sitenos, limits, seats, groups, dates)
|
||||
self.addTable(vbox1, 'playerDetailedStats', flags, playerids, sitenos, limits, type, seats, groups, dates)
|
||||
|
||||
self.db.rollback()
|
||||
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, groups, dates):
|
||||
def addTable(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates):
|
||||
row = 0
|
||||
sqlrow = 0
|
||||
colalias,colshow,colheading,colxalign,colformat = 0,1,2,3,4
|
||||
|
@ -231,7 +234,7 @@ class GuiPlayerStats (threading.Thread):
|
|||
else: holecards = flags[0]
|
||||
|
||||
tmp = self.sql.query[query]
|
||||
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, seats, groups, dates)
|
||||
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, type, seats, groups, dates)
|
||||
self.cursor.execute(tmp)
|
||||
result = self.cursor.fetchall()
|
||||
colnames = [desc[0].lower() for desc in self.cursor.description]
|
||||
|
@ -317,9 +320,9 @@ class GuiPlayerStats (threading.Thread):
|
|||
row += 1
|
||||
vbox.show_all()
|
||||
|
||||
#end def addTable(self, query, vars, playerids, sitenos, limits, seats):
|
||||
#end def addTable(self, query, vars, playerids, sitenos, limits, type, seats, groups, dates):
|
||||
|
||||
def refineQuery(self, query, flags, playerids, sitenos, limits, seats, groups, dates):
|
||||
def refineQuery(self, query, flags, playerids, sitenos, limits, type, seats, groups, dates):
|
||||
if not flags: holecards = False
|
||||
else: holecards = flags[0]
|
||||
|
||||
|
@ -344,13 +347,30 @@ class GuiPlayerStats (threading.Thread):
|
|||
query = query.replace('<groupbyseats>', '')
|
||||
query = query.replace('<orderbyseats>', '')
|
||||
|
||||
if [x for x in limits if str(x).isdigit()]:
|
||||
blindtest = str(tuple([x for x in limits if str(x).isdigit()]))
|
||||
lims = [int(x) for x in limits if x.isdigit()]
|
||||
nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']
|
||||
bbtest = "and ( (gt.limitType = 'fl' and gt.bigBlind in "
|
||||
# and ( (limit and bb in()) or (nolimit and bb in ()) )
|
||||
if lims:
|
||||
blindtest = str(tuple(lims))
|
||||
blindtest = blindtest.replace("L", "")
|
||||
blindtest = blindtest.replace(",)",")")
|
||||
query = query.replace("<gtbigBlind_test>", " and gt.bigBlind in " + blindtest + " ")
|
||||
bbtest = bbtest + blindtest + ' ) '
|
||||
else:
|
||||
query = query.replace("<gtbigBlind_test>", "")
|
||||
bbtest = bbtest + '(-1) ) '
|
||||
bbtest = bbtest + " or (gt.limitType = 'nl' and gt.bigBlind in "
|
||||
if nolims:
|
||||
blindtest = str(tuple(nolims))
|
||||
blindtest = blindtest.replace("L", "")
|
||||
blindtest = blindtest.replace(",)",")")
|
||||
bbtest = bbtest + blindtest + ' ) )'
|
||||
else:
|
||||
bbtest = bbtest + '(-1) ) )'
|
||||
if type == 'ring':
|
||||
bbtest = bbtest + " and gt.type = 'ring' "
|
||||
elif type == 'tour':
|
||||
bbtest = bbtest + " and gt.type = 'tour' "
|
||||
query = query.replace("<gtbigBlind_test>", bbtest)
|
||||
|
||||
if holecards: # pinch level variables for hole card query
|
||||
query = query.replace("<hgameTypeId>", "hp.startcards")
|
||||
|
|
|
@ -1720,6 +1720,9 @@ class Sql:
|
|||
self.query['getSiteId'] = """SELECT id from Sites where name = %s"""
|
||||
self.query['getGames'] = """SELECT DISTINCT category from Gametypes"""
|
||||
self.query['getLimits'] = """SELECT DISTINCT bigBlind from Gametypes ORDER by bigBlind DESC"""
|
||||
self.query['getLimits2'] = """SELECT DISTINCT type, limitType, bigBlind
|
||||
from Gametypes
|
||||
ORDER by type, limitType DESC, bigBlind DESC"""
|
||||
|
||||
if db_server == 'mysql':
|
||||
self.query['playerDetailedStats'] = """
|
||||
|
@ -1775,7 +1778,7 @@ class Sql:
|
|||
inner join Gametypes gt on (gt.Id = h.gameTypeId)
|
||||
inner join Sites s on (s.Id = gt.siteId)
|
||||
where hp.playerId in <player_test>
|
||||
and hp.tourneysPlayersId IS NULL
|
||||
/*and hp.tourneysPlayersId IS NULL*/
|
||||
and h.seats <seats_test>
|
||||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
|
@ -1797,11 +1800,11 @@ class Sql:
|
|||
else concat('Z', <position>)
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,maxbigblind desc
|
||||
,upper(gt.limitType)
|
||||
,s.name
|
||||
"""
|
||||
else: # assume postgresql
|
||||
elif db_server == 'postgresql':
|
||||
self.query['playerDetailedStats'] = """
|
||||
select <hgameTypeId> AS hgametypeid
|
||||
,gt.base
|
||||
|
@ -1855,7 +1858,7 @@ class Sql:
|
|||
inner join Gametypes gt on (gt.Id = h.gameTypeId)
|
||||
inner join Sites s on (s.Id = gt.siteId)
|
||||
where hp.playerId in <player_test>
|
||||
and hp.tourneysPlayersId IS NULL
|
||||
/*and hp.tourneysPlayersId IS NULL*/
|
||||
and h.seats <seats_test>
|
||||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
|
@ -1878,12 +1881,91 @@ class Sql:
|
|||
else 'Z'||<position>
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,maxbigblind desc
|
||||
,s.name
|
||||
"""
|
||||
elif db_server == 'sqlite':
|
||||
self.query['playerDetailedStats'] = """
|
||||
select <hgameTypeId> AS hgametypeid
|
||||
,gt.base
|
||||
,gt.category
|
||||
,upper(gt.limitType) AS limittype
|
||||
,s.name
|
||||
,min(gt.bigBlind) AS minbigblind
|
||||
,max(gt.bigBlind) AS maxbigblind
|
||||
/*,<hcgametypeId> AS gtid*/
|
||||
,<position> AS plposition
|
||||
,count(1) AS n
|
||||
,100.0*sum(cast(hp.street0VPI as <signed>integer))/count(1) AS vpip
|
||||
,100.0*sum(cast(hp.street0Aggr as <signed>integer))/count(1) AS pfr
|
||||
,case when sum(cast(hp.street0_3Bchance as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.street0_3Bdone as <signed>integer))/sum(cast(hp.street0_3Bchance as <signed>integer))
|
||||
end AS pf3
|
||||
,case when sum(cast(hp.stealattemptchance as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.stealattempted as <signed>integer))/sum(cast(hp.stealattemptchance as <signed>integer))
|
||||
end AS steals
|
||||
,100.0*sum(cast(hp.street1Seen as <signed>integer))/count(1) AS saw_f
|
||||
,100.0*sum(cast(hp.sawShowdown as <signed>integer))/count(1) AS sawsd
|
||||
,case when sum(cast(hp.street1Seen as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.sawShowdown as <signed>integer))/sum(cast(hp.street1Seen as <signed>integer))
|
||||
end AS wtsdwsf
|
||||
,case when sum(cast(hp.sawShowdown as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.wonAtSD as <signed>integer))/sum(cast(hp.sawShowdown as <signed>integer))
|
||||
end AS wmsd
|
||||
,case when sum(cast(hp.street1Seen as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.street1Aggr as <signed>integer))/sum(cast(hp.street1Seen as <signed>integer))
|
||||
end AS flafq
|
||||
,case when sum(cast(hp.street2Seen as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.street2Aggr as <signed>integer))/sum(cast(hp.street2Seen as <signed>integer))
|
||||
end AS tuafq
|
||||
,case when sum(cast(hp.street3Seen as <signed>integer)) = 0 then -999
|
||||
else 100.0*sum(cast(hp.street3Aggr as <signed>integer))/sum(cast(hp.street3Seen as <signed>integer))
|
||||
end AS rvafq
|
||||
,case when sum(cast(hp.street1Seen as <signed>integer))+sum(cast(hp.street2Seen as <signed>integer))+sum(cast(hp.street3Seen as <signed>integer)) = 0 then -999
|
||||
else 100.0*(sum(cast(hp.street1Aggr as <signed>integer))+sum(cast(hp.street2Aggr as <signed>integer))+sum(cast(hp.street3Aggr as <signed>integer)))
|
||||
/(sum(cast(hp.street1Seen as <signed>integer))+sum(cast(hp.street2Seen as <signed>integer))+sum(cast(hp.street3Seen as <signed>integer)))
|
||||
end AS pofafq
|
||||
,sum(hp.totalProfit)/100.0 AS net
|
||||
,sum(hp.rake)/100.0 AS rake
|
||||
,100.0*avg(hp.totalProfit/(gt.bigBlind+0.0)) AS bbper100
|
||||
,avg(hp.totalProfit)/100.0 AS profitperhand
|
||||
,100.0*avg((hp.totalProfit+hp.rake)/(gt.bigBlind+0.0)) AS bb100xr
|
||||
,avg((hp.totalProfit+hp.rake)/100.0) AS profhndxr
|
||||
,avg(h.seats+0.0) AS avgseats
|
||||
,variance(hp.totalProfit/100.0) AS variance
|
||||
from HandsPlayers hp
|
||||
inner join Hands h on (h.id = hp.handId)
|
||||
inner join Gametypes gt on (gt.Id = h.gameTypeId)
|
||||
inner join Sites s on (s.Id = gt.siteId)
|
||||
where hp.playerId in <player_test>
|
||||
/*and hp.tourneysPlayersId IS NULL*/
|
||||
and h.seats <seats_test>
|
||||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
and to_char(h.handStart, 'YYYY-MM-DD') <datestest>
|
||||
group by hgameTypeId
|
||||
,hp.playerId
|
||||
,gt.base
|
||||
,gt.category
|
||||
<groupbyseats>
|
||||
,plposition
|
||||
,upper(gt.limitType)
|
||||
,s.name
|
||||
order by hp.playerId
|
||||
,gt.base
|
||||
,gt.category
|
||||
<orderbyseats>
|
||||
,case <position> when 'B' then 'B'
|
||||
when 'S' then 'S'
|
||||
when '0' then 'Y'
|
||||
else 'Z'||<position>
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,maxbigblind desc
|
||||
,upper(gt.limitType)
|
||||
,s.name
|
||||
"""
|
||||
#elif db_server == 'sqlite':
|
||||
# self.query['playerDetailedStats'] = """ """
|
||||
|
||||
if db_server == 'mysql':
|
||||
self.query['playerStats'] = """
|
||||
|
|
Loading…
Reference in New Issue
Block a user