Merge branch 'master' of git://git.assembla.com/fpdboz.git

This commit is contained in:
Eric Blade 2009-12-17 04:07:25 -05:00
commit b25dedbf5e
7 changed files with 28 additions and 14 deletions

View File

@ -1867,8 +1867,10 @@ class Database:
,(name, site_id)) ,(name, site_id))
#Get last id might be faster here. #Get last id might be faster here.
#c.execute ("SELECT id FROM Players WHERE name=%s", (name,)) #c.execute ("SELECT id FROM Players WHERE name=%s", (name,))
tmp = [self.get_last_insert_id(c)] result = self.get_last_insert_id(c)
return tmp[0] else:
result = tmp[1]
return result
def insertGameTypes(self, row): def insertGameTypes(self, row):
c = self.get_cursor() c = self.get_cursor()

View File

@ -17,6 +17,7 @@
#fpdb modules #fpdb modules
import Card import Card
from decimal import Decimal
DEBUG = False DEBUG = False
@ -43,9 +44,9 @@ class DerivedStats():
self.handsplayers[player[1]]['totalProfit'] = 0 self.handsplayers[player[1]]['totalProfit'] = 0
self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Seen'] = False
self.handsplayers[player[1]]['street4Aggr'] = 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]]['sawShowdown'] = False
self.handsplayers[player[1]]['wonAtSD'] = False self.handsplayers[player[1]]['wonAtSD'] = 0.0
for i in range(5): for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0 self.handsplayers[player[1]]['street%dCalls' % i] = 0
self.handsplayers[player[1]]['street%dBets' % i] = 0 self.handsplayers[player[1]]['street%dBets' % i] = 0
@ -135,7 +136,7 @@ class DerivedStats():
#hand.players = [[seat, name, chips],[seat, name, chips]] #hand.players = [[seat, name, chips],[seat, name, chips]]
for player in hand.players: for player in hand.players:
self.handsplayers[player[1]]['seatNo'] = player[0] 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:]): for i, street in enumerate(hand.actionStreets[2:]):
self.seen(self.hand, i+1) 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 # 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) self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees)
if self.handsplayers[player]['street1Seen'] == True: if self.handsplayers[player]['street1Seen'] == True:
self.handsplayers[player]['wonWhenSeenStreet1'] = True self.handsplayers[player]['wonWhenSeenStreet1'] = 1.0
if self.handsplayers[player]['sawShowdown'] == True: if self.handsplayers[player]['sawShowdown'] == True:
self.handsplayers[player]['wonAtSD'] = True self.handsplayers[player]['wonAtSD'] = 1.0
for player in hand.pot.committed: for player in hand.pot.committed:
self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])) self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player]))

View File

@ -479,7 +479,8 @@ class Filters(threading.Thread):
self.cursor.execute(self.sql.query['getLimits2']) self.cursor.execute(self.sql.query['getLimits2'])
# selects limitType, bigBlind # selects limitType, bigBlind
result = self.db.cursor.fetchall() result = self.db.cursor.fetchall()
fl, nl = False, False found = {'nl':False, 'fl':False, 'ring':False, 'tour':False}
if len(result) >= 1: if len(result) >= 1:
hbox = gtk.HBox(True, 0) hbox = gtk.HBox(True, 0)
vbox1.pack_start(hbox, False, False, 0) vbox1.pack_start(hbox, False, False, 0)
@ -487,7 +488,6 @@ class Filters(threading.Thread):
hbox.pack_start(vbox2, False, False, 0) hbox.pack_start(vbox2, False, False, 0)
vbox3 = gtk.VBox(False, 0) vbox3 = gtk.VBox(False, 0)
hbox.pack_start(vbox3, False, False, 0) hbox.pack_start(vbox3, False, False, 0)
found = {'nl':False, 'fl':False, 'ring':False, 'tour':False}
for i, line in enumerate(result): for i, line in enumerate(result):
if "UseType" in self.display: if "UseType" in self.display:
if line[0] != self.display["UseType"]: if line[0] != self.display["UseType"]:

View File

@ -387,6 +387,18 @@ Left-Drag to Move"
<location seat="8" x="0" y="181"> </location> <location seat="8" x="0" y="181"> </location>
<location seat="9" x="70" y="53"> </location> <location seat="9" x="70" y="53"> </location>
</layout> </layout>
<layout fav_seat="6" height="547" max="10" width="794">
<location seat="1" x="698" y="69"> </location>
<location seat="2" x="716" y="243"> </location>
<location seat="3" x="699" y="301"> </location>
<location seat="4" x="456" y="391"> </location>
<location seat="5" x="338" y="369"> </location>
<location seat="6" x="98" y="363"> </location>
<location seat="7" x="15" y="242"> </location>
<location seat="8" x="11" y="55"> </location>
<location seat="9" x="341" y="30"> </location>
<location seat="10" x="562" y="8"> </location>
</layout>
</site> </site>

View File

@ -2789,8 +2789,6 @@ class Sql:
,hp.tourneyTypeId ,hp.tourneyTypeId
,date_format(h.handStart, 'd%y%m%d') ,date_format(h.handStart, 'd%y%m%d')
""" """
#>>>>>>> 28ca49d592c8e706ad6ee58dd26655bcc33fc5fb:pyfpdb/SQL.py
#"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['rebuildHudCache'] = """ self.query['rebuildHudCache'] = """
INSERT INTO HudCache INSERT INTO HudCache

View File

@ -158,7 +158,7 @@ class fpdb_db:
if not os.path.isdir(Configuration.DIR_DATABASES) and not database == ":memory:": if not os.path.isdir(Configuration.DIR_DATABASES) and not database == ":memory:":
print "Creating directory: '%s'" % (Configuration.DIR_DATABASES) print "Creating directory: '%s'" % (Configuration.DIR_DATABASES)
os.mkdir(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 ) self.db = sqlite3.connect(database, detect_types=sqlite3.PARSE_DECLTYPES )
sqlite3.register_converter("bool", lambda x: bool(int(x))) sqlite3.register_converter("bool", lambda x: bool(int(x)))
sqlite3.register_adapter(bool, lambda x: "1" if x else "0") sqlite3.register_adapter(bool, lambda x: "1" if x else "0")

View File

@ -440,8 +440,9 @@ class Importer:
if self.callHud and hand.dbid_hands != 0: if self.callHud and hand.dbid_hands != 0:
#print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands #print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands
#pipe the Hands.id out to the HUD #pipe the Hands.id out to the HUD
print "fpdb_import: sending hand to hud", handsId, "pipe =", self.caller.pipe_to_hud 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.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep)
self.database.commit()
errors = getattr(hhc, 'numErrors') errors = getattr(hhc, 'numErrors')
stored = getattr(hhc, 'numHands') stored = getattr(hhc, 'numHands')