When all players are selected in player stats

The site filter settings were bypassed.

This fix only selects all players from selected sites
This commit is contained in:
Gerko de Roo 2010-02-23 18:55:09 +01:00
parent af6dbc8d5f
commit 9dac1f1b84
2 changed files with 23 additions and 4 deletions

View File

@ -81,7 +81,7 @@ class GuiPlayerStats (threading.Thread):
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display) self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
self.filters.registerButton1Name("_Filters") self.filters.registerButton1Name("_Filters")
self.filters.registerButton1Callback(self.showDetailFilter) self.filters.registerButton1Callback(self.showDetailFilter)
self.filters.registerButton2Name("_Refresh Stats") self.filters.registerButton2Name("_Refresh")
self.filters.registerButton2Callback(self.refreshStats) self.filters.registerButton2Callback(self.refreshStats)
# ToDo: store in config # ToDo: store in config
@ -482,6 +482,22 @@ class GuiPlayerStats (threading.Thread):
gametest = "and gt.category IS NULL" gametest = "and gt.category IS NULL"
query = query.replace("<game_test>", gametest) query = query.replace("<game_test>", 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("<site_test>", sitetest)
if seats: if seats:
query = query.replace('<seats_test>', 'between ' + str(seats['from']) + ' and ' + str(seats['to'])) query = query.replace('<seats_test>', 'between ' + str(seats['from']) + ' and ' + str(seats['to']))
if 'show' in seats and seats['show']: if 'show' in seats and seats['show']:
@ -520,7 +536,7 @@ class GuiPlayerStats (threading.Thread):
blindtest = str(tuple(nolims)) blindtest = str(tuple(nolims))
blindtest = blindtest.replace("L", "") blindtest = blindtest.replace("L", "")
blindtest = blindtest.replace(",)",")") blindtest = blindtest.replace(",)",")")
bbtest = bbtest + blindtest + ' ) ) )' bbtest = bbtest + blindtest + ' ) )'
else: else:
bbtest = bbtest + '(-1) ) )' bbtest = bbtest + '(-1) ) )'
if type == 'ring': if type == 'ring':
@ -539,7 +555,7 @@ class GuiPlayerStats (threading.Thread):
query = query.replace("<orderbyhgameTypeId>", "") query = query.replace("<orderbyhgameTypeId>", "")
groupLevels = "show" not in str(limits) groupLevels = "show" not in str(limits)
if groupLevels: if groupLevels:
query = query.replace("<hgameTypeId>", "p.name") query = query.replace("<hgameTypeId>", "-1")
else: else:
query = query.replace("<hgameTypeId>", "h.gameTypeId") query = query.replace("<hgameTypeId>", "h.gameTypeId")

View File

@ -1915,6 +1915,7 @@ class Sql:
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
<game_test> <game_test>
<site_test>
/*and hp.tourneysPlayersId IS NULL*/ /*and hp.tourneysPlayersId IS NULL*/
and h.seats <seats_test> and h.seats <seats_test>
<flagtest> <flagtest>
@ -1999,6 +2000,7 @@ class Sql:
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
<game_test> <game_test>
<site_test>
/*and hp.tourneysPlayersId IS NULL*/ /*and hp.tourneysPlayersId IS NULL*/
and h.seats <seats_test> and h.seats <seats_test>
<flagtest> <flagtest>
@ -2085,6 +2087,7 @@ class Sql:
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
<game_test> <game_test>
<site_test>
/*and hp.tourneysPlayersId IS NULL*/ /*and hp.tourneysPlayersId IS NULL*/
and h.seats <seats_test> and h.seats <seats_test>
<flagtest> <flagtest>