Add all/none checkboxes for limits, tidy up stats tables some more
This commit is contained in:
parent
de98d5dd15
commit
0ad2b06e97
|
@ -82,6 +82,9 @@ class Filters(threading.Thread):
|
||||||
limitsFrame.set_label_align(0.0, 0.0)
|
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.cbNoLimits = None
|
||||||
|
self.cbAllLimits = None
|
||||||
|
|
||||||
self.fillLimitsFrame(vbox, display)
|
self.fillLimitsFrame(vbox, display)
|
||||||
limitsFrame.add(vbox)
|
limitsFrame.add(vbox)
|
||||||
|
@ -197,22 +200,39 @@ class Filters(threading.Thread):
|
||||||
cb = gtk.CheckButton(str(limit))
|
cb = gtk.CheckButton(str(limit))
|
||||||
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)
|
||||||
cb.set_active(True)
|
if limit != "None":
|
||||||
|
cb.set_active(True)
|
||||||
|
return(cb)
|
||||||
|
|
||||||
def __set_site_select(self, w, site):
|
def __set_site_select(self, w, site):
|
||||||
print w.get_active()
|
#print w.get_active()
|
||||||
self.sites[site] = w.get_active()
|
self.sites[site] = w.get_active()
|
||||||
print "self.sites[%s] set to %s" %(site, self.sites[site])
|
print "self.sites[%s] set to %s" %(site, self.sites[site])
|
||||||
|
|
||||||
def __set_game_select(self, w, game):
|
def __set_game_select(self, w, game):
|
||||||
print w.get_active()
|
#print w.get_active()
|
||||||
self.games[game] = w.get_active()
|
self.games[game] = w.get_active()
|
||||||
print "self.games[%s] set to %s" %(game, self.games[game])
|
print "self.games[%s] set to %s" %(game, self.games[game])
|
||||||
|
|
||||||
def __set_limit_select(self, w, limit):
|
def __set_limit_select(self, w, limit):
|
||||||
print w.get_active()
|
#print w.get_active()
|
||||||
self.limits[limit] = w.get_active()
|
self.limits[limit] = w.get_active()
|
||||||
print "self.limit[%s] set to %s" %(limit, self.limits[limit])
|
print "self.limit[%s] set to %s" %(limit, self.limits[limit])
|
||||||
|
if str(limit).isdigit():
|
||||||
|
if self.limits[limit]:
|
||||||
|
if self.cbNoLimits != None:
|
||||||
|
self.cbNoLimits.set_active(False)
|
||||||
|
else:
|
||||||
|
if self.cbAllLimits != None:
|
||||||
|
self.cbAllLimits.set_active(False)
|
||||||
|
elif limit == "All":
|
||||||
|
if self.limits[limit]:
|
||||||
|
for cb in self.cbLimits.values():
|
||||||
|
cb.set_active(True)
|
||||||
|
elif limit == "None":
|
||||||
|
if self.limits[limit]:
|
||||||
|
for cb in self.cbLimits.values():
|
||||||
|
cb.set_active(False)
|
||||||
|
|
||||||
def fillPlayerFrame(self, vbox):
|
def fillPlayerFrame(self, vbox):
|
||||||
for site in self.conf.get_supported_sites():
|
for site in self.conf.get_supported_sites():
|
||||||
|
@ -250,14 +270,29 @@ class Filters(threading.Thread):
|
||||||
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:
|
||||||
for line in result:
|
hbox = gtk.HBox(True, 0)
|
||||||
|
vbox.pack_start(hbox, False, False, 0)
|
||||||
|
vbox1 = gtk.VBox(False, 0)
|
||||||
|
hbox.pack_start(vbox1, False, False, 0)
|
||||||
|
vbox2 = gtk.VBox(False, 0)
|
||||||
|
hbox.pack_start(vbox2, False, False, 0)
|
||||||
|
for i, line in enumerate(result):
|
||||||
hbox = gtk.HBox(False, 0)
|
hbox = gtk.HBox(False, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
if i < len(result)/2:
|
||||||
self.createLimitLine(hbox, line[0])
|
vbox1.pack_start(hbox, False, False, 0)
|
||||||
|
else:
|
||||||
|
vbox2.pack_start(hbox, False, False, 0)
|
||||||
|
self.cbLimits[line[0]] = self.createLimitLine(hbox, 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)
|
vbox.pack_start(hbox, False, True, 0)
|
||||||
self.createLimitLine(hbox, "Separate levels")
|
self.cbAllLimits = self.createLimitLine(hbox, "All")
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
vbox.pack_start(hbox, False, True, 0)
|
||||||
|
self.cbNoLimits = self.createLimitLine(hbox, "None")
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
vbox.pack_start(hbox, False, True, 0)
|
||||||
|
cb = self.createLimitLine(hbox, "Separate levels")
|
||||||
else:
|
else:
|
||||||
print "INFO: No games returned from database"
|
print "INFO: No games returned from database"
|
||||||
|
|
||||||
|
|
|
@ -633,10 +633,7 @@ class FpdbSQLQueries:
|
||||||
concat(upper(stats.limitType), ' '
|
concat(upper(stats.limitType), ' '
|
||||||
,concat(upper(substring(stats.category,1,1)),substring(stats.category,2) ), ' '
|
,concat(upper(substring(stats.category,1,1)),substring(stats.category,2) ), ' '
|
||||||
,stats.name, ' $'
|
,stats.name, ' $'
|
||||||
,cast(trim(leading ' ' from
|
,cast(stats.bigBlindDesc as char)
|
||||||
case when stats.bigBlind < 100 then format(stats.bigBlind/100.0,2)
|
|
||||||
else format(stats.bigBlind/100.0,0)
|
|
||||||
end ) as char)
|
|
||||||
) AS Game
|
) AS Game
|
||||||
,stats.n
|
,stats.n
|
||||||
,stats.vpip
|
,stats.vpip
|
||||||
|
@ -651,25 +648,20 @@ class FpdbSQLQueries:
|
||||||
,stats.TuAFq
|
,stats.TuAFq
|
||||||
,stats.RvAFq
|
,stats.RvAFq
|
||||||
,stats.PoFAFq
|
,stats.PoFAFq
|
||||||
/* if you have handsactions data the next 3 fields should give same answer as
|
|
||||||
following 3 commented out fields */
|
|
||||||
,stats.Net
|
,stats.Net
|
||||||
,stats.BBper100
|
,stats.BBper100
|
||||||
,stats.Profitperhand
|
,stats.Profitperhand
|
||||||
/*,format(hprof2.sum_profit/100.0,2) AS Net
|
,case when hprof2.variance = -999 then '-'
|
||||||
,format((hprof2.sum_profit/(stats.bigBlind+0.0)) / (stats.n/100.0),2)
|
else format(hprof2.variance, 2)
|
||||||
AS BBlPer100
|
end AS Variance
|
||||||
,hprof2.profitperhand AS Profitperhand
|
|
||||||
*/
|
|
||||||
,format(hprof2.variance,2) AS Variance
|
|
||||||
FROM
|
FROM
|
||||||
(select /* stats from hudcache */
|
(select /* stats from hudcache */
|
||||||
gt.base
|
gt.base
|
||||||
,gt.category
|
,gt.category
|
||||||
,upper(gt.limitType) as limitType
|
,upper(gt.limitType) as limitType
|
||||||
,s.name
|
,s.name
|
||||||
,gt.bigBlind
|
,<selectgt.bigBlind> AS bigBlindDesc
|
||||||
,hc.gametypeId
|
,<hcgametypeId> AS gtId
|
||||||
,sum(HDs) AS n
|
,sum(HDs) AS n
|
||||||
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
||||||
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
||||||
|
@ -681,27 +673,27 @@ class FpdbSQLQueries:
|
||||||
end AS steals
|
end AS steals
|
||||||
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
||||||
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'oo'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
||||||
end AS wmsd
|
end AS wmsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
||||||
end AS FlAFq
|
end AS FlAFq
|
||||||
,case when sum(street2Seen) = 0 then 'oo'
|
,case when sum(street2Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
||||||
end AS TuAFq
|
end AS TuAFq
|
||||||
,case when sum(street3Seen) = 0 then 'oo'
|
,case when sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
||||||
end AS RvAFq
|
end AS RvAFq
|
||||||
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then 'oo'
|
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
||||||
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
||||||
end AS PoFAFq
|
end AS PoFAFq
|
||||||
,format(sum(totalProfit)/100.0,2) AS Net
|
,format(sum(totalProfit)/100.0,2) AS Net
|
||||||
,format((sum(totalProfit)/(gt.bigBlind+0.0)) / (sum(HDs)/100.0),2)
|
,format((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0),2)
|
||||||
AS BBper100
|
AS BBper100
|
||||||
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
|
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
|
||||||
from Gametypes gt
|
from Gametypes gt
|
||||||
|
@ -713,100 +705,94 @@ class FpdbSQLQueries:
|
||||||
,gt.category
|
,gt.category
|
||||||
,upper(gt.limitType)
|
,upper(gt.limitType)
|
||||||
,s.name
|
,s.name
|
||||||
,gt.bigBlind
|
<groupbygt.bigBlind>
|
||||||
,hc.gametypeId
|
,gtId
|
||||||
) stats
|
) stats
|
||||||
inner join
|
inner join
|
||||||
( select # profit from handsplayers/handsactions
|
( select # profit from handsplayers/handsactions
|
||||||
hprof.gameTypeId, sum(hprof.profit) sum_profit,
|
hprof.gtId, sum(hprof.profit) sum_profit,
|
||||||
avg(hprof.profit/100.0) profitperhand,
|
avg(hprof.profit/100.0) profitperhand,
|
||||||
variance(hprof.profit/100.0) variance
|
case when hprof.gtId = -1 then -999
|
||||||
|
else variance(hprof.profit/100.0)
|
||||||
|
end as variance
|
||||||
from
|
from
|
||||||
(select hp.handId, h.gameTypeId, hp.winnings, SUM(ha.amount) as costs
|
(select hp.handId, <hgameTypeId> as gtId, hp.winnings, SUM(ha.amount) as costs
|
||||||
, hp.winnings - SUM(ha.amount) as profit
|
, hp.winnings - SUM(ha.amount) as profit
|
||||||
from HandsPlayers hp
|
from HandsPlayers hp
|
||||||
inner join Hands h ON h.id = hp.handId
|
inner join Hands h ON h.id = hp.handId
|
||||||
left join HandsActions ha ON ha.handPlayerId = hp.id
|
left join HandsActions ha ON ha.handPlayerId = hp.id
|
||||||
where hp.playerId in <player_test>
|
where hp.playerId in <player_test>
|
||||||
and hp.tourneysPlayersId IS NULL
|
and hp.tourneysPlayersId IS NULL
|
||||||
group by hp.handId, h.gameTypeId, hp.position, hp.winnings
|
group by hp.handId, gtId, hp.position, hp.winnings
|
||||||
) hprof
|
) hprof
|
||||||
group by hprof.gameTypeId
|
group by hprof.gtId
|
||||||
) hprof2
|
) hprof2
|
||||||
on hprof2.gameTypeId = stats.gameTypeId
|
on hprof2.gtId = stats.gtId
|
||||||
order by stats.category, stats.limittype, stats.bigBlind"""
|
order by stats.category, stats.limittype, stats.bigBlindDesc"""
|
||||||
elif(self.dbname == 'PostgreSQL'):
|
elif(self.dbname == 'PostgreSQL'):
|
||||||
self.query['playerStats'] = """
|
self.query['playerStats'] = """
|
||||||
SELECT upper(stats.limitType) || ' '
|
SELECT upper(stats.limitType) || ' '
|
||||||
|| initcap(stats.category) || ' '
|
|| initcap(stats.category) || ' '
|
||||||
|| stats.name || ' $'
|
|| stats.name || ' $'
|
||||||
|| trim(leading ' ' from
|
|| stats.bigBlindDesc AS Game
|
||||||
case when stats.bigBlind < 100 then to_char(stats.bigBlind/100.0,'0D00')
|
,stats.n
|
||||||
else to_char(stats.bigBlind/100.0,'99990')
|
,stats.vpip
|
||||||
end ) AS Game
|
,stats.pfr
|
||||||
,stats.n
|
,stats.pf3
|
||||||
,stats.vpip
|
,stats.steals
|
||||||
,stats.pfr
|
,stats.saw_f
|
||||||
,stats.pf3
|
,stats.sawsd
|
||||||
,stats.steals
|
,stats.wtsdwsf
|
||||||
,stats.saw_f
|
,stats.wmsd
|
||||||
,stats.sawsd
|
,stats.FlAFq
|
||||||
,stats.wtsdwsf
|
,stats.TuAFq
|
||||||
,stats.wmsd
|
,stats.RvAFq
|
||||||
,stats.FlAFq
|
,stats.PoFAFq
|
||||||
,stats.TuAFq
|
,stats.Net
|
||||||
,stats.RvAFq
|
,stats.BBper100
|
||||||
,stats.PoFAFq
|
,stats.Profitperhand
|
||||||
/* if you have handsactions data the next 3 fields should give same answer as
|
,case when hprof2.variance = -999 then '-'
|
||||||
following 3 commented out fields */
|
else to_char(hprof2.variance, '0D00')
|
||||||
,stats.Net
|
end AS Variance
|
||||||
,stats.BBper100
|
|
||||||
,stats.Profitperhand
|
|
||||||
/*,to_char(hprof2.sum_profit/100.0,'9G999G990D00') AS Net
|
|
||||||
,to_char((hprof2.sum_profit/(stats.bigBlind+0.0)) / (stats.n/100.0), '990D00')
|
|
||||||
AS BBper100
|
|
||||||
,hprof2.profitperhand AS Profitperhand
|
|
||||||
*/
|
|
||||||
,round(hprof2.variance,2) AS Variance
|
|
||||||
FROM
|
FROM
|
||||||
(select gt.base
|
(select gt.base
|
||||||
,gt.category
|
,gt.category
|
||||||
,upper(gt.limitType) as limitType
|
,upper(gt.limitType) AS limitType
|
||||||
,s.name
|
,s.name
|
||||||
,gt.bigBlind
|
,<selectgt.bigBlind> AS bigBlindDesc
|
||||||
,hc.gametypeId
|
,<hcgametypeId> AS gtId
|
||||||
,sum(HDs) as n
|
,sum(HDs) as n
|
||||||
,to_char(100.0*sum(street0VPI)/sum(HDs),'90D0') AS vpip
|
,to_char(100.0*sum(street0VPI)/sum(HDs),'90D0') AS vpip
|
||||||
,to_char(100.0*sum(street0Aggr)/sum(HDs),'90D0') AS pfr
|
,to_char(100.0*sum(street0Aggr)/sum(HDs),'90D0') AS pfr
|
||||||
,case when sum(street0_3b4bchance) = 0 then '0'
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
||||||
end AS pf3
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '-'
|
||||||
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
||||||
end AS steals
|
end AS steals
|
||||||
,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f
|
,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f
|
||||||
,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd
|
,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else to_char(100.0*sum(sawShowdown)/sum(street1Seen),'90D0')
|
else to_char(100.0*sum(sawShowdown)/sum(street1Seen),'90D0')
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'oo'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
else to_char(100.0*sum(wonAtSD)/sum(sawShowdown),'90D0')
|
else to_char(100.0*sum(wonAtSD)/sum(sawShowdown),'90D0')
|
||||||
end AS wmsd
|
end AS wmsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else to_char(100.0*sum(street1Aggr)/sum(street1Seen),'90D0')
|
else to_char(100.0*sum(street1Aggr)/sum(street1Seen),'90D0')
|
||||||
end AS FlAFq
|
end AS FlAFq
|
||||||
,case when sum(street2Seen) = 0 then 'oo'
|
,case when sum(street2Seen) = 0 then '-'
|
||||||
else to_char(100.0*sum(street2Aggr)/sum(street2Seen),'90D0')
|
else to_char(100.0*sum(street2Aggr)/sum(street2Seen),'90D0')
|
||||||
end AS TuAFq
|
end AS TuAFq
|
||||||
,case when sum(street3Seen) = 0 then 'oo'
|
,case when sum(street3Seen) = 0 then '-'
|
||||||
else to_char(100.0*sum(street3Aggr)/sum(street3Seen),'90D0')
|
else to_char(100.0*sum(street3Aggr)/sum(street3Seen),'90D0')
|
||||||
end AS RvAFq
|
end AS RvAFq
|
||||||
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then 'oo'
|
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-'
|
||||||
else to_char(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
else to_char(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
||||||
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),'90D0')
|
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),'90D0')
|
||||||
end AS PoFAFq
|
end AS PoFAFq
|
||||||
,round(sum(totalProfit)/100.0,2) AS Net
|
,round(sum(totalProfit)/100.0,2) AS Net
|
||||||
,to_char((sum(totalProfit)/(gt.bigBlind+0.0)) / (sum(HDs)/100.0), '990D00')
|
,to_char((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0), '990D00')
|
||||||
AS BBper100
|
AS BBper100
|
||||||
,to_char(sum(totalProfit/100.0) / (sum(HDs)+0.0), '990D0000') AS Profitperhand
|
,to_char(sum(totalProfit/100.0) / (sum(HDs)+0.0), '990D0000') AS Profitperhand
|
||||||
from Gametypes gt
|
from Gametypes gt
|
||||||
|
@ -818,31 +804,30 @@ class FpdbSQLQueries:
|
||||||
,gt.category
|
,gt.category
|
||||||
,upper(gt.limitType)
|
,upper(gt.limitType)
|
||||||
,s.name
|
,s.name
|
||||||
,gt.bigBlind
|
<groupbygt.bigBlind>
|
||||||
,hc.gametypeId
|
,gtId
|
||||||
) stats
|
) stats
|
||||||
inner join
|
inner join
|
||||||
( select
|
( select
|
||||||
hprof.gameTypeId, sum(hprof.profit) AS sum_profit,
|
hprof.gtId, sum(hprof.profit) AS sum_profit,
|
||||||
avg(hprof.profit/100.0) AS profitperhand,
|
avg(hprof.profit/100.0) AS profitperhand,
|
||||||
variance(hprof.profit/100.0) AS variance
|
case when hprof.gtId = -1 then -999
|
||||||
|
else variance(hprof.profit/100.0)
|
||||||
|
end as variance
|
||||||
from
|
from
|
||||||
(select hp.handId,
|
(select hp.handId, <hgameTypeId> as gtId, hp.winnings,
|
||||||
h.gameTypeId,
|
SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
|
||||||
hp.winnings,
|
from HandsPlayers hp
|
||||||
SUM(ha.amount) as costs,
|
inner join Hands h ON (h.id = hp.handId)
|
||||||
hp.winnings - SUM(ha.amount) as profit
|
left join HandsActions ha ON (ha.handPlayerId = hp.id)
|
||||||
from HandsPlayers hp
|
where hp.playerId in <player_test>
|
||||||
inner join Hands h ON (h.id = hp.handId)
|
and hp.tourneysPlayersId IS NULL
|
||||||
left join HandsActions ha ON (ha.handPlayerId = hp.id)
|
group by hp.handId, gtId, hp.position, hp.winnings
|
||||||
where hp.playerId in <player_test>
|
) hprof
|
||||||
and hp.tourneysPlayersId IS NULL
|
group by hprof.gtId
|
||||||
group by hp.handId, h.gameTypeId, hp.position, hp.winnings
|
|
||||||
) hprof
|
|
||||||
group by hprof.gameTypeId
|
|
||||||
) hprof2
|
) hprof2
|
||||||
on hprof2.gameTypeId = stats.gameTypeId
|
on hprof2.gtId = stats.gtId
|
||||||
order by stats.base, stats.limittype, stats.bigBlind"""
|
order by stats.base, stats.limittype, stats.bigBlindDesc"""
|
||||||
elif(self.dbname == 'SQLite'):
|
elif(self.dbname == 'SQLite'):
|
||||||
self.query['playerStats'] = """ """
|
self.query['playerStats'] = """ """
|
||||||
|
|
||||||
|
@ -878,7 +863,7 @@ class FpdbSQLQueries:
|
||||||
,stats.Net
|
,stats.Net
|
||||||
,stats.BBper100
|
,stats.BBper100
|
||||||
,stats.Profitperhand
|
,stats.Profitperhand
|
||||||
,case when hprof2.variance = -999 then 'NA'
|
,case when hprof2.variance = -999 then '-'
|
||||||
else format(hprof2.variance, 2)
|
else format(hprof2.variance, 2)
|
||||||
end AS Variance
|
end AS Variance
|
||||||
FROM
|
FROM
|
||||||
|
@ -903,32 +888,32 @@ class FpdbSQLQueries:
|
||||||
,case when sum(street0_3b4bchance) = 0 then '0'
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
|
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
|
||||||
end AS pf3
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '-'
|
||||||
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
||||||
end AS steals
|
end AS steals
|
||||||
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
||||||
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'oo'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
||||||
end AS wmsd
|
end AS wmsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
||||||
end AS FlAFq
|
end AS FlAFq
|
||||||
,case when sum(street2Seen) = 0 then 'oo'
|
,case when sum(street2Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
||||||
end AS TuAFq
|
end AS TuAFq
|
||||||
,case when sum(street3Seen) = 0 then 'oo'
|
,case when sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
||||||
end AS RvAFq
|
end AS RvAFq
|
||||||
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then 'oo'
|
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
||||||
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
||||||
end AS PoFAFq
|
end AS PoFAFq
|
||||||
,format(sum(totalProfit)/100.0,2) AS Net
|
,format(sum(totalProfit)/100.0,2) AS Net
|
||||||
,format((sum(totalProfit)/(gt.bigBlind+0.0)) / (sum(HDs)/100.0),2)
|
,format((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0),2)
|
||||||
AS BBper100
|
AS BBper100
|
||||||
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
|
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
|
||||||
from Gametypes gt
|
from Gametypes gt
|
||||||
|
@ -955,7 +940,7 @@ class FpdbSQLQueries:
|
||||||
end as PlPosition,
|
end as PlPosition,
|
||||||
sum(hprof.profit) as sum_profit,
|
sum(hprof.profit) as sum_profit,
|
||||||
avg(hprof.profit/100.0) as profitperhand,
|
avg(hprof.profit/100.0) as profitperhand,
|
||||||
case when hprof.gtId = 1 then -999
|
case when hprof.gtId = -1 then -999
|
||||||
else variance(hprof.profit/100.0)
|
else variance(hprof.profit/100.0)
|
||||||
end as variance
|
end as variance
|
||||||
from
|
from
|
||||||
|
@ -1005,7 +990,7 @@ class FpdbSQLQueries:
|
||||||
,stats.Net
|
,stats.Net
|
||||||
,stats.BBper100
|
,stats.BBper100
|
||||||
,stats.Profitperhand
|
,stats.Profitperhand
|
||||||
,case when hprof2.variance = -999 then 'NA'
|
,case when hprof2.variance = -999 then '-'
|
||||||
else to_char(hprof2.variance, '0D00')
|
else to_char(hprof2.variance, '0D00')
|
||||||
end AS Variance
|
end AS Variance
|
||||||
FROM
|
FROM
|
||||||
|
@ -1030,27 +1015,27 @@ class FpdbSQLQueries:
|
||||||
,case when sum(street0_3b4bchance) = 0 then '0'
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
||||||
end AS pf3
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '-'
|
||||||
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
||||||
end AS steals
|
end AS steals
|
||||||
,to_char(round(100.0*sum(street1Seen)/sum(HDs)),'90D0') AS saw_f
|
,to_char(round(100.0*sum(street1Seen)/sum(HDs)),'90D0') AS saw_f
|
||||||
,to_char(round(100.0*sum(sawShowdown)/sum(HDs)),'90D0') AS sawsd
|
,to_char(round(100.0*sum(sawShowdown)/sum(HDs)),'90D0') AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'NA'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else to_char(round(100.0*sum(sawShowdown)/sum(street1Seen)),'90D0')
|
else to_char(round(100.0*sum(sawShowdown)/sum(street1Seen)),'90D0')
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'NA'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
else to_char(round(100.0*sum(wonAtSD)/sum(sawShowdown)),'90D0')
|
else to_char(round(100.0*sum(wonAtSD)/sum(sawShowdown)),'90D0')
|
||||||
end AS wmsd
|
end AS wmsd
|
||||||
,case when sum(street1Seen) = 0 then 'NA'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else to_char(round(100.0*sum(street1Aggr)/sum(street1Seen)),'90D0')
|
else to_char(round(100.0*sum(street1Aggr)/sum(street1Seen)),'90D0')
|
||||||
end AS FlAFq
|
end AS FlAFq
|
||||||
,case when sum(street2Seen) = 0 then 'NA'
|
,case when sum(street2Seen) = 0 then '-'
|
||||||
else to_char(round(100.0*sum(street2Aggr)/sum(street2Seen)),'90D0')
|
else to_char(round(100.0*sum(street2Aggr)/sum(street2Seen)),'90D0')
|
||||||
end AS TuAFq
|
end AS TuAFq
|
||||||
,case when sum(street3Seen) = 0 then 'NA'
|
,case when sum(street3Seen) = 0 then '-'
|
||||||
else to_char(round(100.0*sum(street3Aggr)/sum(street3Seen)),'90D0')
|
else to_char(round(100.0*sum(street3Aggr)/sum(street3Seen)),'90D0')
|
||||||
end AS RvAFq
|
end AS RvAFq
|
||||||
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then 'NA'
|
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-'
|
||||||
else to_char(round(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
else to_char(round(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
||||||
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen))),'90D0')
|
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen))),'90D0')
|
||||||
end AS PoFAFq
|
end AS PoFAFq
|
||||||
|
@ -1076,7 +1061,7 @@ class FpdbSQLQueries:
|
||||||
) stats
|
) stats
|
||||||
inner join
|
inner join
|
||||||
( select /* profit from handsplayers/handsactions */
|
( select /* profit from handsplayers/handsactions */
|
||||||
hprof.gameTypeId,
|
hprof.gtId,
|
||||||
case when hprof.position = 'B' then -2
|
case when hprof.position = 'B' then -2
|
||||||
when hprof.position = 'S' then -1
|
when hprof.position = 'S' then -1
|
||||||
when hprof.position in ('3','4') then 2
|
when hprof.position in ('3','4') then 2
|
||||||
|
@ -1085,11 +1070,11 @@ class FpdbSQLQueries:
|
||||||
end as PlPosition,
|
end as PlPosition,
|
||||||
sum(hprof.profit) as sum_profit,
|
sum(hprof.profit) as sum_profit,
|
||||||
avg(hprof.profit/100.0) as profitperhand,
|
avg(hprof.profit/100.0) as profitperhand,
|
||||||
case when hprof.gameTypeId = 1 then -999
|
case when hprof.gtId = -1 then -999
|
||||||
else variance(hprof.profit/100.0)
|
else variance(hprof.profit/100.0)
|
||||||
end as variance
|
end as variance
|
||||||
from
|
from
|
||||||
(select hp.handId, <hgameTypeId> as gameTypeId, hp.position, hp.winnings
|
(select hp.handId, <hgameTypeId> as gtId, hp.position, hp.winnings
|
||||||
, SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
|
, SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
|
||||||
from HandsPlayers hp
|
from HandsPlayers hp
|
||||||
inner join Hands h ON h.id = hp.handId
|
inner join Hands h ON h.id = hp.handId
|
||||||
|
@ -1098,9 +1083,9 @@ class FpdbSQLQueries:
|
||||||
and hp.tourneysPlayersId IS NULL
|
and hp.tourneysPlayersId IS NULL
|
||||||
group by hp.handId, gameTypeId, hp.position, hp.winnings
|
group by hp.handId, gameTypeId, hp.position, hp.winnings
|
||||||
) hprof
|
) hprof
|
||||||
group by hprof.gameTypeId, PlPosition
|
group by hprof.gtId, PlPosition
|
||||||
) hprof2
|
) hprof2
|
||||||
on ( hprof2.gameTypeId = stats.gtId
|
on ( hprof2.gtId = stats.gtId
|
||||||
and hprof2.PlPosition = stats.PlPosition)
|
and hprof2.PlPosition = stats.PlPosition)
|
||||||
order by stats.category, stats.limitType, stats.bigBlindDesc, cast(stats.PlPosition as smallint)
|
order by stats.category, stats.limitType, stats.bigBlindDesc, cast(stats.PlPosition as smallint)
|
||||||
"""
|
"""
|
||||||
|
@ -1168,24 +1153,24 @@ class FpdbSQLQueries:
|
||||||
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
||||||
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
||||||
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
else format(100.0*sum(sawShowdown)/sum(street1Seen),1)
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'oo'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
,case when sum(sawShowdown) = 0 then 'oo'
|
,case when sum(sawShowdown) = 0 then '-'
|
||||||
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
else format(100.0*sum(wonAtSD)/sum(sawShowdown),1)
|
||||||
end AS wmsd
|
end AS wmsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
else format(100.0*sum(street1Aggr)/sum(street1Seen),1)
|
||||||
end AS FlAFq
|
end AS FlAFq
|
||||||
,case when sum(street2Seen) = 0 then 'oo'
|
,case when sum(street2Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
else format(100.0*sum(street2Aggr)/sum(street2Seen),1)
|
||||||
end AS TuAFq
|
end AS TuAFq
|
||||||
,case when sum(street3Seen) = 0 then 'oo'
|
,case when sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
else format(100.0*sum(street3Aggr)/sum(street3Seen),1)
|
||||||
end AS RvAFq
|
end AS RvAFq
|
||||||
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then 'oo'
|
,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-'
|
||||||
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr))
|
||||||
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
/(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1)
|
||||||
end AS PoFAFq
|
end AS PoFAFq
|
||||||
|
|
|
@ -30,6 +30,9 @@ class GuiPlayerStats (threading.Thread):
|
||||||
def __init__(self, config, querylist, debug=True):
|
def __init__(self, config, querylist, debug=True):
|
||||||
self.debug=debug
|
self.debug=debug
|
||||||
self.conf=config
|
self.conf=config
|
||||||
|
self.MYSQL_INNODB = 2
|
||||||
|
self.PGSQL = 3
|
||||||
|
self.SQLITE = 4
|
||||||
|
|
||||||
# create new db connection to avoid conflicts with other threads
|
# create new db connection to avoid conflicts with other threads
|
||||||
self.db = fpdb_db.fpdb_db()
|
self.db = fpdb_db.fpdb_db()
|
||||||
|
@ -43,16 +46,19 @@ 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())
|
||||||
|
|
||||||
filters_display = { "Heroes" : True,
|
filters_display = { "Heroes" : True,
|
||||||
"Sites" : True,
|
"Sites" : True,
|
||||||
"Games" : False,
|
"Games" : False,
|
||||||
"Limits" : False,
|
"Limits" : True,
|
||||||
"Dates" : False,
|
"LimitSep" : True,
|
||||||
"Button1" : False,
|
"Dates" : False,
|
||||||
"Button2" : False
|
"Button1" : True,
|
||||||
|
"Button2" : False
|
||||||
}
|
}
|
||||||
|
|
||||||
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.registerButton1Callback(self.refreshStats)
|
||||||
|
|
||||||
self.stat_table = None
|
self.stat_table = None
|
||||||
self.stats_frame = None
|
self.stats_frame = None
|
||||||
|
@ -85,6 +91,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
sites = self.filters.getSites()
|
sites = self.filters.getSites()
|
||||||
heroes = self.filters.getHeroes()
|
heroes = self.filters.getHeroes()
|
||||||
siteids = self.filters.getSiteIds()
|
siteids = self.filters.getSiteIds()
|
||||||
|
limits = self.filters.getLimits()
|
||||||
sitenos = []
|
sitenos = []
|
||||||
playerids = []
|
playerids = []
|
||||||
|
|
||||||
|
@ -104,19 +111,15 @@ class GuiPlayerStats (threading.Thread):
|
||||||
if not playerids:
|
if not playerids:
|
||||||
print "No player ids found"
|
print "No player ids found"
|
||||||
return
|
return
|
||||||
|
if not limits:
|
||||||
|
print "No limits found"
|
||||||
|
return
|
||||||
|
|
||||||
self.createStatsTable(vbox, playerids, sitenos)
|
self.createStatsTable(vbox, playerids, sitenos, limits)
|
||||||
|
|
||||||
def createStatsTable(self, vbox, playerids, sitenos):
|
def createStatsTable(self, vbox, playerids, sitenos, limits):
|
||||||
tmp = self.sql.query['playerStats']
|
tmp = self.sql.query['playerStats']
|
||||||
|
tmp = self.refineQuery(tmp, playerids, sitenos, limits)
|
||||||
nametest = str(tuple(playerids))
|
|
||||||
nametest = nametest.replace("L", "")
|
|
||||||
nametest = nametest.replace(",)",")")
|
|
||||||
|
|
||||||
tmp = tmp.replace("<player_test>", nametest)
|
|
||||||
tmp = tmp.replace("<gtbigBlind_test>", "1 = 1")
|
|
||||||
|
|
||||||
self.cursor.execute(tmp)
|
self.cursor.execute(tmp)
|
||||||
result = self.cursor.fetchall()
|
result = self.cursor.fetchall()
|
||||||
cols = 18
|
cols = 18
|
||||||
|
@ -159,3 +162,74 @@ class GuiPlayerStats (threading.Thread):
|
||||||
eb.show()
|
eb.show()
|
||||||
self.db.db.commit()
|
self.db.db.commit()
|
||||||
#end def fillStatsFrame(self, vbox):
|
#end def fillStatsFrame(self, vbox):
|
||||||
|
|
||||||
|
def refineQuery(self, query, playerids, sitenos, limits):
|
||||||
|
if playerids:
|
||||||
|
nametest = str(tuple(playerids))
|
||||||
|
nametest = nametest.replace("L", "")
|
||||||
|
nametest = nametest.replace(",)",")")
|
||||||
|
query = query.replace("<player_test>", nametest)
|
||||||
|
else:
|
||||||
|
query = query.replace("<player_test>", "1 = 2")
|
||||||
|
|
||||||
|
if [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(",)",")")
|
||||||
|
query = query.replace("<gtbigBlind_test>", "gt.bigBlind in " + blindtest)
|
||||||
|
else:
|
||||||
|
query = query.replace("<gtbigBlind_test>", "gt.bigBlind = -1 ")
|
||||||
|
|
||||||
|
groupLevels = "Separate" not in str(limits)
|
||||||
|
if groupLevels:
|
||||||
|
if self.db.backend == self.MYSQL_INNODB:
|
||||||
|
bigblindselect = """concat(trim(leading ' ' from
|
||||||
|
case when min(gt.bigBlind) < 100
|
||||||
|
then format(min(gt.bigBlind)/100.0, 2)
|
||||||
|
else format(min(gt.bigBlind)/100.0, 0)
|
||||||
|
end)
|
||||||
|
,' - '
|
||||||
|
,trim(leading ' ' from
|
||||||
|
case when max(gt.bigBlind) < 100
|
||||||
|
then format(max(gt.bigBlind)/100.0, 2)
|
||||||
|
else format(max(gt.bigBlind)/100.0, 0)
|
||||||
|
end)
|
||||||
|
) """
|
||||||
|
else:
|
||||||
|
bigblindselect = """trim(leading ' ' from
|
||||||
|
case when min(gt.bigBlind) < 100
|
||||||
|
then to_char(min(gt.bigBlind)/100.0,'90D00')
|
||||||
|
else to_char(min(gt.bigBlind)/100.0,'999990')
|
||||||
|
end)
|
||||||
|
|| ' - ' ||
|
||||||
|
trim(leading ' ' from
|
||||||
|
case when max(gt.bigBlind) < 100
|
||||||
|
then to_char(max(gt.bigBlind)/100.0,'90D00')
|
||||||
|
else to_char(max(gt.bigBlind)/100.0,'999990')
|
||||||
|
end) """
|
||||||
|
query = query.replace("<selectgt.bigBlind>", bigblindselect)
|
||||||
|
query = query.replace("<groupbygt.bigBlind>", "")
|
||||||
|
query = query.replace("<hcgametypeId>", "-1")
|
||||||
|
query = query.replace("<hgameTypeId>", "-1")
|
||||||
|
else:
|
||||||
|
if self.db.backend == self.MYSQL_INNODB:
|
||||||
|
bigblindselect = """trim(leading ' ' from
|
||||||
|
case when gt.bigBlind < 100
|
||||||
|
then format(gt.bigBlind/100.0, 2)
|
||||||
|
else format(gt.bigBlind/100.0, 0)
|
||||||
|
end
|
||||||
|
) """
|
||||||
|
else:
|
||||||
|
bigblindselect = """trim(leading ' ' from
|
||||||
|
case when gt.bigBlind < 100
|
||||||
|
then to_char(gt.bigBlind/100.0,'90D00')
|
||||||
|
else to_char(gt.bigBlind/100.0,'999990')
|
||||||
|
end
|
||||||
|
) """
|
||||||
|
query = query.replace("<selectgt.bigBlind>", bigblindselect)
|
||||||
|
query = query.replace("<groupbygt.bigBlind>", ",gt.bigBlind")
|
||||||
|
query = query.replace("<hcgametypeId>", "hc.gametypeId")
|
||||||
|
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||||
|
#print "query =\n", query
|
||||||
|
return(query)
|
||||||
|
#end def refineQuery(self, query, playerids, sitenos, limits):
|
||||||
|
|
|
@ -30,15 +30,15 @@ class GuiPositionalStats (threading.Thread):
|
||||||
def __init__(self, config, querylist, debug=True):
|
def __init__(self, config, querylist, debug=True):
|
||||||
self.debug=debug
|
self.debug=debug
|
||||||
self.conf=config
|
self.conf=config
|
||||||
|
self.MYSQL_INNODB = 2
|
||||||
|
self.PGSQL = 3
|
||||||
|
self.SQLITE = 4
|
||||||
|
|
||||||
# create new db connection to avoid conflicts with other threads
|
# create new db connection to avoid conflicts with other threads
|
||||||
self.db = fpdb_db.fpdb_db()
|
self.db = fpdb_db.fpdb_db()
|
||||||
self.db.do_connect(self.conf)
|
self.db.do_connect(self.conf)
|
||||||
self.cursor=self.db.cursor
|
self.cursor=self.db.cursor
|
||||||
self.sql = querylist
|
self.sql = querylist
|
||||||
self.MYSQL_INNODB = 2
|
|
||||||
self.PGSQL = 3
|
|
||||||
self.SQLITE = 4
|
|
||||||
|
|
||||||
settings = {}
|
settings = {}
|
||||||
settings.update(config.get_db_parameters())
|
settings.update(config.get_db_parameters())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user