Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats

This commit is contained in:
Mika Bostrom 2009-12-23 19:25:06 +02:00
commit 17aae75f01
2 changed files with 9 additions and 6 deletions

View File

@ -1569,7 +1569,8 @@ class Database:
line[55] = gid # gametypeId line[55] = gid # gametypeId
line[56] = pids[p] # playerId line[56] = pids[p] # playerId
line[57] = len(pids) # activeSeats line[57] = len(pids) # activeSeats
line[58] = pdata[p]['position'] pos = {-2:'B', -1:'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' }
line[58] = pos[pdata[p]['position']]
line[59] = pdata[p]['tourneyTypeId'] line[59] = pdata[p]['tourneyTypeId']
line[60] = styleKey # styleKey line[60] = styleKey # styleKey
inserts.append(line) inserts.append(line)
@ -1580,19 +1581,20 @@ class Database:
for row in inserts: for row in inserts:
# Try to do the update first: # Try to do the update first:
num = cursor.execute(update_hudcache, row) num = cursor.execute(update_hudcache, row)
# Test statusmessage to see if update worked, do insert if not #print "DEBUG: values: %s" % row[-6:]
# num is a cursor in sqlite # Test statusmessage to see if update worked, do insert if not
# num is a cursor in sqlite
if ((self.backend == self.PGSQL and cursor.statusmessage != "UPDATE 1") if ((self.backend == self.PGSQL and cursor.statusmessage != "UPDATE 1")
or (self.backend == self.MYSQL_INNODB and num == 0) or (self.backend == self.MYSQL_INNODB and num == 0)
or (self.backend == self.SQLITE and num.rowcount == 0)): or (self.backend == self.SQLITE and num.rowcount == 0)):
#move the last 6 items in WHERE clause of row from the end of the array #move the last 6 items in WHERE clause of row from the end of the array
# to the beginning for the INSERT statement # to the beginning for the INSERT statement
print "DEBUG: using INSERT: %s" % num #print "DEBUG: using INSERT: %s" % num
row = row[-6:] + row[:-6] row = row[-6:] + row[:-6]
num = cursor.execute(insert_hudcache, row) num = cursor.execute(insert_hudcache, row)
print "DEBUG: Successfully(?: %s) updated HudCacho using INSERT" % num #print "DEBUG: Successfully(?: %s) updated HudCacho using INSERT" % num
else: else:
print "DEBUG: Successfully updated HudCacho using UPDATE" #print "DEBUG: Successfully updated HudCacho using UPDATE"
pass pass
def isDuplicate(self, gametypeID, siteHandNo): def isDuplicate(self, gametypeID, siteHandNo):

View File

@ -452,6 +452,7 @@ class Importer:
# FIXME: Need to test for bulk import that isn't rebuilding the cache # FIXME: Need to test for bulk import that isn't rebuilding the cache
if self.callHud: if self.callHud:
hand.updateHudCache(self.database) hand.updateHudCache(self.database)
self.database.commit()
#pipe the Hands.id out to the HUD #pipe the Hands.id out to the HUD
for hid in to_hud: for hid in to_hud: