remove surplus db variable and debug mysql problem in previous commit

This commit is contained in:
sqlcoder 2009-05-04 20:36:11 +01:00
parent f9a769ebd3
commit de98d5dd15
2 changed files with 18 additions and 12 deletions

View File

@ -27,7 +27,7 @@ import Filters
import FpdbSQLQueries import FpdbSQLQueries
class GuiPositionalStats (threading.Thread): class GuiPositionalStats (threading.Thread):
def __init__(self, db, config, querylist, debug=True): def __init__(self, config, querylist, debug=True):
self.debug=debug self.debug=debug
self.conf=config self.conf=config
@ -56,7 +56,7 @@ class GuiPositionalStats (threading.Thread):
"Button2" : False "Button2" : False
} }
self.filters = Filters.Filters(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("Refresh")
self.filters.registerButton1Callback(self.refreshStats) self.filters.registerButton1Callback(self.refreshStats)
@ -252,15 +252,21 @@ class GuiPositionalStats (threading.Thread):
#end def fillStatsFrame(self, vbox): #end def fillStatsFrame(self, vbox):
def refineQuery(self, query, playerids, sitenos, limits): def refineQuery(self, query, playerids, sitenos, limits):
nametest = str(tuple(playerids)) if playerids:
nametest = nametest.replace("L", "") nametest = str(tuple(playerids))
nametest = nametest.replace(",)",")") nametest = nametest.replace("L", "")
query = query.replace("<player_test>", nametest) nametest = nametest.replace(",)",")")
query = query.replace("<player_test>", nametest)
else:
query = query.replace("<player_test>", "1 = 2")
blindtest = str(tuple([x for x in limits if str(x).isdigit()])) if [x for x in limits if str(x).isdigit()]:
blindtest = blindtest.replace("L", "") blindtest = str(tuple([x for x in limits if str(x).isdigit()]))
blindtest = blindtest.replace(",)",")") blindtest = blindtest.replace("L", "")
query = query.replace("<gtbigBlind_test>", "gt.bigBlind in " + blindtest) 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) groupLevels = "Separate" not in str(limits)
if groupLevels: if groupLevels:
@ -271,7 +277,7 @@ class GuiPositionalStats (threading.Thread):
else format(min(gt.bigBlind)/100.0, 0) else format(min(gt.bigBlind)/100.0, 0)
end) end)
,' - ' ,' - '
trim(leading ' ' from ,trim(leading ' ' from
case when max(gt.bigBlind) < 100 case when max(gt.bigBlind) < 100
then format(max(gt.bigBlind)/100.0, 2) then format(max(gt.bigBlind)/100.0, 2)
else format(max(gt.bigBlind)/100.0, 0) else format(max(gt.bigBlind)/100.0, 0)

View File

@ -337,7 +337,7 @@ class fpdb:
self.add_and_display_tab(ps_tab, "Player Stats") self.add_and_display_tab(ps_tab, "Player Stats")
def tab_positional_stats(self, widget, data): def tab_positional_stats(self, widget, data):
new_ps_thread=GuiPositionalStats.GuiPositionalStats(self.db, self.config, self.querydict) new_ps_thread=GuiPositionalStats.GuiPositionalStats(self.config, self.querydict)
self.threads.append(new_ps_thread) self.threads.append(new_ps_thread)
ps_tab=new_ps_thread.get_vbox() ps_tab=new_ps_thread.get_vbox()
self.add_and_display_tab(ps_tab, "Positional Stats") self.add_and_display_tab(ps_tab, "Positional Stats")