game selector for graphs added.

exception caught for games selector for player stats
This commit is contained in:
Gerko de Roo 2010-01-22 18:36:21 +01:00
parent eb6e60f578
commit 6fa3d693d9
3 changed files with 29 additions and 7 deletions

View File

@ -137,6 +137,8 @@ class GuiGraphViewer (threading.Thread):
heroes = self.filters.getHeroes() heroes = self.filters.getHeroes()
siteids = self.filters.getSiteIds() siteids = self.filters.getSiteIds()
limits = self.filters.getLimits() limits = self.filters.getLimits()
games = self.filters.getGames()
for i in ('show', 'none'): for i in ('show', 'none'):
if i in limits: if i in limits:
limits.remove(i) limits.remove(i)
@ -171,7 +173,7 @@ class GuiGraphViewer (threading.Thread):
#Get graph data from DB #Get graph data from DB
starttime = time() starttime = time()
(green, blue, red) = self.getRingProfitGraph(playerids, sitenos, limits) (green, blue, red) = self.getRingProfitGraph(playerids, sitenos, limits, games)
print "Graph generated in: %s" %(time() - starttime) print "Graph generated in: %s" %(time() - starttime)
self.ax.set_title("Profit graph for ring games") self.ax.set_title("Profit graph for ring games")
@ -212,7 +214,7 @@ class GuiGraphViewer (threading.Thread):
#end of def showClicked #end of def showClicked
def getRingProfitGraph(self, names, sites, limits): def getRingProfitGraph(self, names, sites, limits, games):
tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite'] tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite']
# print "DEBUG: getRingProfitGraph" # print "DEBUG: getRingProfitGraph"
start_date, end_date = self.filters.getDates() start_date, end_date = self.filters.getDates()
@ -224,6 +226,22 @@ class GuiGraphViewer (threading.Thread):
sitetest = str(tuple(sites)) sitetest = str(tuple(sites))
#nametest = nametest.replace("L", "") #nametest = nametest.replace("L", "")
q = []
for m in self.filters.display.items():
if m[0] == 'Games' and m[1]:
for n in games:
if games[n]:
q.append(n)
if len(q) > 0:
gametest = str(tuple(q))
gametest = gametest.replace("L", "")
gametest = gametest.replace(",)",")")
gametest = gametest.replace("u'","'")
gametest = "and gt.category in %s" % gametest
else:
gametest = "and gt.category IS NULL"
tmp = tmp.replace("<game_test>", gametest)
lims = [int(x) for x in limits if x.isdigit()] lims = [int(x) for x in limits if x.isdigit()]
potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl'] potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl']
nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl'] nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']

View File

@ -474,11 +474,14 @@ class GuiPlayerStats (threading.Thread):
for n in games: for n in games:
if games[n]: if games[n]:
q.append(n) q.append(n)
if len(q) > 0:
gametest = str(tuple(q)) gametest = str(tuple(q))
gametest = gametest.replace("L", "") gametest = gametest.replace("L", "")
gametest = gametest.replace(",)",")") gametest = gametest.replace(",)",")")
gametest = gametest.replace("u'","'") gametest = gametest.replace("u'","'")
gametest = "and gt.category in %s" % gametest gametest = "and gt.category in %s" % gametest
else:
gametest = "and gt.category IS NULL"
query = query.replace("<game_test>", gametest) query = query.replace("<game_test>", gametest)
if seats: if seats:

View File

@ -2576,6 +2576,7 @@ class Sql:
AND h.handStart > '<startdate_test>' AND h.handStart > '<startdate_test>'
AND h.handStart < '<enddate_test>' AND h.handStart < '<enddate_test>'
<limit_test> <limit_test>
<game_test>
AND hp.tourneysPlayersId IS NULL AND hp.tourneysPlayersId IS NULL
GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit
ORDER BY h.handStart""" ORDER BY h.handStart"""