clean-up code to get playerId in gui-stats and gui-graphs

Conflicts:

	pyfpdb/GuiGraphViewer.py
This commit is contained in:
Worros 2010-01-27 13:04:13 +08:00
parent 241dc1e717
commit fb7aae9186
2 changed files with 7 additions and 12 deletions

View File

@ -147,12 +147,10 @@ class GuiGraphViewer (threading.Thread):
for site in sites: for site in sites:
if sites[site] == True: if sites[site] == True:
sitenos.append(siteids[site]) sitenos.append(siteids[site])
c = self.db.get_cursor()
_hname = Charset.to_utf8(heroes[site]) _hname = Charset.to_utf8(heroes[site])
c.execute(self.sql.query['getPlayerId'], (_hname,)) result = self.db.get_player_id(self.conf, site, _hname)
result = c.fetchall() if result is not None:
if len(result) == 1: playerids.append(int(result))
playerids.append( int(result[0][0]) )
if not sitenos: if not sitenos:
#Should probably pop up here. #Should probably pop up here.

View File

@ -189,13 +189,10 @@ class GuiPlayerStats (threading.Thread):
for site in sites: for site in sites:
if sites[site] == True: if sites[site] == True:
sitenos.append(siteids[site]) sitenos.append(siteids[site])
# Nasty hack to deal with multiple sites + same player name -Eric
que = self.sql.query['getPlayerId'] + " AND siteId=%d" % siteids[site]
_hname = Charset.to_utf8(heroes[site]) _hname = Charset.to_utf8(heroes[site])
self.cursor.execute(que, (_hname,)) result = self.db.get_player_id(self.conf, site, _hname)
result = self.db.cursor.fetchall() if result is not None:
if len(result) == 1: playerids.append(int(result))
playerids.append(result[0][0])
if not sitenos: if not sitenos:
#Should probably pop up here. #Should probably pop up here.