From 86a1f86b51472b0fe0c43e8f54b7fb6b7db1b693 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 10 Jul 2010 23:21:36 +0200 Subject: [PATCH] tourney query returns key information - now just need to display it --- pyfpdb/GuiTourneyPlayerStats.py | 11 ++++++----- pyfpdb/SQL.py | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pyfpdb/GuiTourneyPlayerStats.py b/pyfpdb/GuiTourneyPlayerStats.py index 211621d3..4f548583 100644 --- a/pyfpdb/GuiTourneyPlayerStats.py +++ b/pyfpdb/GuiTourneyPlayerStats.py @@ -102,7 +102,7 @@ class GuiTourneyPlayerStats (threading.Thread): #end def __init__ 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 row = 0 sqlrow = 0 @@ -111,6 +111,7 @@ class GuiTourneyPlayerStats (threading.Thread): query = self.refineQuery(query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates) self.cursor.execute(query) result = self.cursor.fetchall() + #print "result of the big query in addGrid:",result colnames = [desc[0].lower() for desc in self.cursor.description] # pre-fetch some constant values: @@ -293,14 +294,14 @@ class GuiTourneyPlayerStats (threading.Thread): def refineQuery(self, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates): having = '' - print "start of refinequery, playerids:",playerids + #print "start of refinequery, playerids:",playerids if playerids: nametest = str(tuple(playerids)) nametest = nametest.replace("L", "") nametest = nametest.replace(",)",")") else: nametest = "1 = 2" - print "refinequery, nametest after initial creation:",nametest + #print "refinequery, nametest after initial creation:",nametest pname = "p.name" # 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 @@ -341,7 +342,7 @@ class GuiTourneyPlayerStats (threading.Thread): sitetest = "and tt.siteId in %s" % sitetest#[1:-1] else: 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) if seats: @@ -425,7 +426,7 @@ class GuiTourneyPlayerStats (threading.Thread): # # unset flag in self.columns to hide posn column # [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) #end def refineQuery diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 03d12424..94a2b436 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2262,19 +2262,19 @@ class Sql: select t.tourneyTypeId AS tourneyTypeId ,p.name AS playerName ,s.name AS siteName - ,sum(t.winnings)/100.0 AS profit - ,sum(t.buyin+t.fee)/100.0 AS invested + ,sum(tp.winnings)/100.0 AS profit + ,sum(tt.buyin+tt.fee)/100.0 AS invested from TourneysPlayers tp inner join Tourneys t on (t.id = tp.tourneyId) 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) where tp.playerId in and date_format(t.startTime, '%Y-%m-%d %T') group by tourneyTypeId, playerName order by tourneyTypeId - ,pname - ,s.name""" + ,playerName + ,siteName""" elif db_server == 'postgresql': self.query['tourneyPlayerDetailedStats'] = """TODO""" elif db_server == 'sqlite':