Merge branch 'master' of git://git.assembla.com/fpdb-sql

This commit is contained in:
Eratosthenes 2010-01-31 22:56:01 -05:00
commit 428d228de8
5 changed files with 10 additions and 6 deletions

View File

@ -788,10 +788,11 @@ class Database:
def get_player_id(self, config, site, player_name): def get_player_id(self, config, site, player_name):
c = self.connection.cursor() c = self.connection.cursor()
#print "get_player_id: player_name =", player_name, type(player_name) print "get_player_id: player_name =", player_name, type(player_name)
p_name = Charset.to_utf8(player_name) p_name = Charset.to_utf8(player_name)
c.execute(self.sql.query['get_player_id'], (p_name, site)) c.execute(self.sql.query['get_player_id'], (p_name, site))
row = c.fetchone() row = c.fetchone()
print "player id =", row
if row: if row:
return row[0] return row[0]
else: else:

View File

@ -297,7 +297,8 @@ class Filters(threading.Thread):
def __set_hero_name(self, w, site): def __set_hero_name(self, w, site):
_name = w.get_text() _name = w.get_text()
_guiname = Charset.to_gui(_name) # get_text() returns a str but we want internal variables to be unicode:
_guiname = unicode(_name)
self.heroes[site] = _guiname self.heroes[site] = _guiname
# print "DEBUG: setting heroes[%s]: %s"%(site, self.heroes[site]) # print "DEBUG: setting heroes[%s]: %s"%(site, self.heroes[site])
@ -593,7 +594,7 @@ class Filters(threading.Thread):
vbox.pack_start(vbox1, False, False, 0) vbox.pack_start(vbox1, False, False, 0)
self.boxes['limits'] = vbox1 self.boxes['limits'] = vbox1
self.cursor.execute(self.sql.query['getLimits2']) self.cursor.execute(self.sql.query['getLimits3'])
# selects limitType, bigBlind # selects limitType, bigBlind
result = self.db.cursor.fetchall() result = self.db.cursor.fetchall()
found = {'nl':False, 'fl':False, 'pl':False, 'ring':False, 'tour':False} found = {'nl':False, 'fl':False, 'pl':False, 'ring':False, 'tour':False}
@ -614,7 +615,7 @@ class Filters(threading.Thread):
vbox2.pack_start(hbox, False, False, 0) vbox2.pack_start(hbox, False, False, 0)
else: else:
vbox3.pack_start(hbox, False, False, 0) vbox3.pack_start(hbox, False, False, 0)
if line[0] == 'ring': if True: #line[0] == 'ring':
if line[1] == 'fl': if line[1] == 'fl':
name = str(line[2]) name = str(line[2])
found['fl'] = True found['fl'] = True

View File

@ -319,7 +319,7 @@ class GuiGraphViewer (threading.Thread):
winnings = self.db.cursor.fetchall() winnings = self.db.cursor.fetchall()
self.db.rollback() self.db.rollback()
if winnings == (): if len(winnings) == 0:
return (None, None, None) return (None, None, None)
green = map(lambda x:float(x[1]), winnings) green = map(lambda x:float(x[1]), winnings)

View File

@ -526,7 +526,7 @@ class GuiPlayerStats (threading.Thread):
if type == 'ring': if type == 'ring':
bbtest = bbtest + " and gt.type = 'ring' " bbtest = bbtest + " and gt.type = 'ring' "
elif type == 'tour': elif type == 'tour':
bbtest = bbtest + " and gt.type = 'tour' " bbtest = " and gt.type = 'tour' "
query = query.replace("<gtbigBlind_test>", bbtest) query = query.replace("<gtbigBlind_test>", bbtest)
if holecards: # re-use level variables for hole card query if holecards: # re-use level variables for hole card query

View File

@ -2021,6 +2021,7 @@ class Sql:
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['playerDetailedStats'] = """ self.query['playerDetailedStats'] = """
select <hgameTypeId> AS hgametypeid select <hgameTypeId> AS hgametypeid
,<playerName> AS pname
,gt.base ,gt.base
,gt.category AS category ,gt.category AS category
,upper(gt.limitType) AS limittype ,upper(gt.limitType) AS limittype
@ -2072,6 +2073,7 @@ class Sql:
inner join Hands h on (h.id = hp.handId) inner join Hands h on (h.id = hp.handId)
inner join Gametypes gt on (gt.Id = h.gameTypeId) inner join Gametypes gt on (gt.Id = h.gameTypeId)
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = gt.siteId)
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>
/*and hp.tourneysPlayersId IS NULL*/ /*and hp.tourneysPlayersId IS NULL*/