tourney query returns key information - now just need to display it

This commit is contained in:
steffen123 2010-07-10 23:21:36 +02:00
parent 043c3b5bca
commit 86a1f86b51
2 changed files with 11 additions and 10 deletions

View File

@ -102,7 +102,7 @@ class GuiTourneyPlayerStats (threading.Thread):
#end def __init__ #end def __init__
def addGrid(self, vbox, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates): def addGrid(self, vbox, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates):
print "start of addGrid query", query #print "start of addGrid query", query
counter = 0 counter = 0
row = 0 row = 0
sqlrow = 0 sqlrow = 0
@ -111,6 +111,7 @@ class GuiTourneyPlayerStats (threading.Thread):
query = self.refineQuery(query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates) query = self.refineQuery(query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates)
self.cursor.execute(query) self.cursor.execute(query)
result = self.cursor.fetchall() result = self.cursor.fetchall()
#print "result of the big query in addGrid:",result
colnames = [desc[0].lower() for desc in self.cursor.description] colnames = [desc[0].lower() for desc in self.cursor.description]
# pre-fetch some constant values: # pre-fetch some constant values:
@ -293,14 +294,14 @@ class GuiTourneyPlayerStats (threading.Thread):
def refineQuery(self, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates): def refineQuery(self, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates):
having = '' having = ''
print "start of refinequery, playerids:",playerids #print "start of refinequery, playerids:",playerids
if playerids: if playerids:
nametest = str(tuple(playerids)) nametest = str(tuple(playerids))
nametest = nametest.replace("L", "") nametest = nametest.replace("L", "")
nametest = nametest.replace(",)",")") nametest = nametest.replace(",)",")")
else: else:
nametest = "1 = 2" nametest = "1 = 2"
print "refinequery, nametest after initial creation:",nametest #print "refinequery, nametest after initial creation:",nametest
pname = "p.name" pname = "p.name"
# set flag in self.columns to not show player name column # set flag in self.columns to not show player name column
#[x for x in self.columns if x[0] == 'pname'][0][1] = False #TODO: fix and reactivate #[x for x in self.columns if x[0] == 'pname'][0][1] = False #TODO: fix and reactivate
@ -341,7 +342,7 @@ class GuiTourneyPlayerStats (threading.Thread):
sitetest = "and tt.siteId in %s" % sitetest#[1:-1] sitetest = "and tt.siteId in %s" % sitetest#[1:-1]
else: else:
sitetest = "and tt.siteId IS NULL" sitetest = "and tt.siteId IS NULL"
print "refinequery, sitetest before its use for replacement:",sitetest #print "refinequery, sitetest before its use for replacement:",sitetest
query = query.replace("<sitetest>", sitetest) query = query.replace("<sitetest>", sitetest)
if seats: if seats:
@ -425,7 +426,7 @@ class GuiTourneyPlayerStats (threading.Thread):
# # unset flag in self.columns to hide posn column # # unset flag in self.columns to hide posn column
# [x for x in self.columns if x[0] == 'plposition'][0][1] = False # [x for x in self.columns if x[0] == 'plposition'][0][1] = False
print "query at end of refine query:", query #print "query at end of refine query:", query
return(query) return(query)
#end def refineQuery #end def refineQuery

View File

@ -2262,19 +2262,19 @@ class Sql:
select t.tourneyTypeId AS tourneyTypeId select t.tourneyTypeId AS tourneyTypeId
,p.name AS playerName ,p.name AS playerName
,s.name AS siteName ,s.name AS siteName
,sum(t.winnings)/100.0 AS profit ,sum(tp.winnings)/100.0 AS profit
,sum(t.buyin+t.fee)/100.0 AS invested ,sum(tt.buyin+tt.fee)/100.0 AS invested
from TourneysPlayers tp from TourneysPlayers tp
inner join Tourneys t on (t.id = tp.tourneyId) inner join Tourneys t on (t.id = tp.tourneyId)
inner join TourneyTypes tt on (tt.Id = t.tourneyTypeId) inner join TourneyTypes tt on (tt.Id = t.tourneyTypeId)
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = tt.siteId)
inner join Players p on (p.Id = tp.playerId) inner join Players p on (p.Id = tp.playerId)
where tp.playerId in <nametest> <sitetest> where tp.playerId in <nametest> <sitetest>
and date_format(t.startTime, '%Y-%m-%d %T') <datestest> and date_format(t.startTime, '%Y-%m-%d %T') <datestest>
group by tourneyTypeId, playerName group by tourneyTypeId, playerName
order by tourneyTypeId order by tourneyTypeId
,pname ,playerName
,s.name""" ,siteName"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['tourneyPlayerDetailedStats'] = """TODO""" self.query['tourneyPlayerDetailedStats'] = """TODO"""
elif db_server == 'sqlite': elif db_server == 'sqlite':