diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index c5cd156a..9d1f3f85 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1867,8 +1867,10 @@ class Database: ,(name, site_id)) #Get last id might be faster here. #c.execute ("SELECT id FROM Players WHERE name=%s", (name,)) - tmp = [self.get_last_insert_id(c)] - return tmp[0] + result = self.get_last_insert_id(c) + else: + result = tmp[1] + return result def insertGameTypes(self, row): c = self.get_cursor() diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 1064a600..1a34db1e 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -17,6 +17,7 @@ #fpdb modules import Card +from decimal import Decimal DEBUG = False @@ -43,9 +44,9 @@ class DerivedStats(): self.handsplayers[player[1]]['totalProfit'] = 0 self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False - self.handsplayers[player[1]]['wonWhenSeenStreet1'] = False + self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0 self.handsplayers[player[1]]['sawShowdown'] = False - self.handsplayers[player[1]]['wonAtSD'] = False + self.handsplayers[player[1]]['wonAtSD'] = 0.0 for i in range(5): self.handsplayers[player[1]]['street%dCalls' % i] = 0 self.handsplayers[player[1]]['street%dBets' % i] = 0 @@ -135,7 +136,7 @@ class DerivedStats(): #hand.players = [[seat, name, chips],[seat, name, chips]] for player in hand.players: self.handsplayers[player[1]]['seatNo'] = player[0] - self.handsplayers[player[1]]['startCash'] = player[2] + self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) for i, street in enumerate(hand.actionStreets[2:]): self.seen(self.hand, i+1) @@ -155,9 +156,9 @@ class DerivedStats(): # Should be fine for split-pots, but won't be accurate for multi-way pots self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees) if self.handsplayers[player]['street1Seen'] == True: - self.handsplayers[player]['wonWhenSeenStreet1'] = True + self.handsplayers[player]['wonWhenSeenStreet1'] = 1.0 if self.handsplayers[player]['sawShowdown'] == True: - self.handsplayers[player]['wonAtSD'] = True + self.handsplayers[player]['wonAtSD'] = 1.0 for player in hand.pot.committed: self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index c74d5579..dc2e4859 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -479,7 +479,8 @@ class Filters(threading.Thread): self.cursor.execute(self.sql.query['getLimits2']) # selects limitType, bigBlind result = self.db.cursor.fetchall() - fl, nl = False, False + found = {'nl':False, 'fl':False, 'ring':False, 'tour':False} + if len(result) >= 1: hbox = gtk.HBox(True, 0) vbox1.pack_start(hbox, False, False, 0) @@ -487,7 +488,6 @@ class Filters(threading.Thread): hbox.pack_start(vbox2, False, False, 0) vbox3 = gtk.VBox(False, 0) hbox.pack_start(vbox3, False, False, 0) - found = {'nl':False, 'fl':False, 'ring':False, 'tour':False} for i, line in enumerate(result): if "UseType" in self.display: if line[0] != self.display["UseType"]: diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index b0f26c53..b1ebd761 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -387,6 +387,18 @@ Left-Drag to Move" + + + + + + + + + + + + diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 73d380c0..c0319dfe 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2789,8 +2789,6 @@ class Sql: ,hp.tourneyTypeId ,date_format(h.handStart, 'd%y%m%d') """ -#>>>>>>> 28ca49d592c8e706ad6ee58dd26655bcc33fc5fb:pyfpdb/SQL.py -#""" elif db_server == 'postgresql': self.query['rebuildHudCache'] = """ INSERT INTO HudCache diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index baabb4bf..2d7f2e0c 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -158,7 +158,7 @@ class fpdb_db: if not os.path.isdir(Configuration.DIR_DATABASES) and not database == ":memory:": print "Creating directory: '%s'" % (Configuration.DIR_DATABASES) os.mkdir(Configuration.DIR_DATABASES) - database = os.path.join(Configuration.DIR_DATABASE, database) + database = os.path.join(Configuration.DIR_DATABASES, database) self.db = sqlite3.connect(database, detect_types=sqlite3.PARSE_DECLTYPES ) sqlite3.register_converter("bool", lambda x: bool(int(x))) sqlite3.register_adapter(bool, lambda x: "1" if x else "0") diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index ca321de1..3fc35339 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -440,8 +440,9 @@ class Importer: if self.callHud and hand.dbid_hands != 0: #print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands #pipe the Hands.id out to the HUD - print "fpdb_import: sending hand to hud", handsId, "pipe =", self.caller.pipe_to_hud - #self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) + print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud + self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) + self.database.commit() errors = getattr(hhc, 'numErrors') stored = getattr(hhc, 'numHands')