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

This commit is contained in:
Ray 2009-03-28 15:27:09 -04:00
commit e78da7937c
3 changed files with 1 additions and 6 deletions

0
pyfpdb/GuiBulkImport.py Executable file → Normal file
View File

View File

@ -176,7 +176,7 @@ class Hud:
loc = self.config.get_locations(self.table.site, self.max) loc = self.config.get_locations(self.table.site, self.max)
# TODO: is stat_windows getting converted somewhere from a list to a dict, for no good reason? # TODO: is stat_windows getting converted somewhere from a list to a dict, for no good reason?
for i, w in enumerate(self.stat_windows.itervalues()): for i, w in enumerate(self.stat_windows.itervalues()):
(x, y) = loc[adj[i]] (x, y) = loc[adj[i+1]]
w.relocate(x, y) w.relocate(x, y)
return True return True

View File

@ -1413,17 +1413,12 @@ def recognisePlayerIDs(cursor, names, site_id):
if len(ids) != len(names): if len(ids) != len(names):
notfound = [n for n in names if n not in ids] # make list of names not in database notfound = [n for n in names if n not in ids] # make list of names not in database
if notfound: # insert them into database if notfound: # insert them into database
namestring = "name=%s"
for x in xrange(len(notfound)-1):
namestring += " OR name=%s"
# print "namestring=",namestring,"\nnotfound=", notfound
cursor.executemany("INSERT INTO Players (name, siteId) VALUES (%s, "+str(site_id)+")", (notfound)) cursor.executemany("INSERT INTO Players (name, siteId) VALUES (%s, "+str(site_id)+")", (notfound))
q2 = "SELECT name,id FROM Players WHERE name=%s" % " OR name=".join(["%s" for n in notfound]) q2 = "SELECT name,id FROM Players WHERE name=%s" % " OR name=".join(["%s" for n in notfound])
cursor.execute(q2, notfound) # get their new ids cursor.execute(q2, notfound) # get their new ids
tmp = dict(cursor.fetchall()) tmp = dict(cursor.fetchall())
for n in tmp: # put them all into the same dict for n in tmp: # put them all into the same dict
ids[n] = tmp[n] ids[n] = tmp[n]
# print "ids=", ids
# return them in the SAME ORDER that they came in in the names argument, rather than the order they came out of the DB # return them in the SAME ORDER that they came in in the names argument, rather than the order they came out of the DB
return [ids[n] for n in names] return [ids[n] for n in names]
#end def recognisePlayerIDs #end def recognisePlayerIDs