From 9dac1f1b8409966d7bdc6c968e85ef808c685473 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Tue, 23 Feb 2010 18:55:09 +0100 Subject: [PATCH] When all players are selected in player stats The site filter settings were bypassed. This fix only selects all players from selected sites --- pyfpdb/GuiPlayerStats.py | 24 ++++++++++++++++++++---- pyfpdb/SQL.py | 3 +++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index 047c1ff1..39c6c727 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -81,7 +81,7 @@ class GuiPlayerStats (threading.Thread): self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display) self.filters.registerButton1Name("_Filters") self.filters.registerButton1Callback(self.showDetailFilter) - self.filters.registerButton2Name("_Refresh Stats") + self.filters.registerButton2Name("_Refresh") self.filters.registerButton2Callback(self.refreshStats) # ToDo: store in config @@ -481,7 +481,23 @@ class GuiPlayerStats (threading.Thread): else: gametest = "and gt.category IS NULL" query = query.replace("", gametest) - + + sitetest = "" + q = [] + for m in self.filters.display.items(): + if m[0] == 'Sites' and m[1]: + for n in sitenos: + q.append(n) + if len(q) > 0: + sitetest = str(tuple(q)) + sitetest = sitetest.replace("L", "") + sitetest = sitetest.replace(",)",")") + sitetest = sitetest.replace("u'","'") + sitetest = "and gt.siteId in %s" % sitetest + else: + sitetest = "and gt.siteId IS NULL" + query = query.replace("", sitetest) + if seats: query = query.replace('', 'between ' + str(seats['from']) + ' and ' + str(seats['to'])) if 'show' in seats and seats['show']: @@ -520,7 +536,7 @@ class GuiPlayerStats (threading.Thread): blindtest = str(tuple(nolims)) blindtest = blindtest.replace("L", "") blindtest = blindtest.replace(",)",")") - bbtest = bbtest + blindtest + ' ) ) )' + bbtest = bbtest + blindtest + ' ) )' else: bbtest = bbtest + '(-1) ) )' if type == 'ring': @@ -539,7 +555,7 @@ class GuiPlayerStats (threading.Thread): query = query.replace("", "") groupLevels = "show" not in str(limits) if groupLevels: - query = query.replace("", "p.name") + query = query.replace("", "-1") else: query = query.replace("", "h.gameTypeId") diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 6db24fb4..570edb34 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -1915,6 +1915,7 @@ class Sql: inner join Players p on (p.Id = hp.playerId) where hp.playerId in + /*and hp.tourneysPlayersId IS NULL*/ and h.seats @@ -1999,6 +2000,7 @@ class Sql: inner join Players p on (p.Id = hp.playerId) where hp.playerId in + /*and hp.tourneysPlayersId IS NULL*/ and h.seats @@ -2085,6 +2087,7 @@ class Sql: inner join Players p on (p.Id = hp.playerId) where hp.playerId in + /*and hp.tourneysPlayersId IS NULL*/ and h.seats