p45 - implemented HandsPlayers.seatNo

This commit is contained in:
steffen123 2008-08-17 04:44:53 +01:00
parent 18ff57027f
commit 579b44450c
6 changed files with 31 additions and 30 deletions

View File

@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug) alpha2 (release by 17Aug)
====== ======
HandsPlayers.seatNo implement HandsPlayers.seatNo
change tabledesign VALIGN change tabledesign VALIGN
seperate and improve instructions for update seperate and improve instructions for update
@ -14,7 +14,7 @@ delete old mailing list and create fpdb-announce
finish updating filelist finish updating filelist
update abbreviations.txt update abbreviations.txt
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
add minimal instructions for developing to git-instructions
alpha3 alpha3
====== ======

View File

@ -350,7 +350,7 @@ class fpdb:
For howto information please see docs"""+os.sep+"""readme-user.txt For howto information please see docs"""+os.sep+"""readme-user.txt
The abbrevations in the table viewer are explained in docs"""+os.sep+"""abbrevations.txt The abbrevations in the table viewer are explained in docs"""+os.sep+"""abbrevations.txt
This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.add_and_display_tab(mh_tab, "main help") self.add_and_display_tab(mh_tab, "Help")
#end def tab_main_help #end def tab_main_help
def tab_table_viewer(self, widget, data): def tab_table_viewer(self, widget, data):
@ -359,7 +359,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings) new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings)
self.threads.append(new_tv_thread) self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox() tv_tab=new_tv_thread.get_vbox()
self.add_and_display_tab(tv_tab, "table viewer") self.add_and_display_tab(tv_tab, "Table Viewer")
#end def tab_table_viewer #end def tab_table_viewer
def __init__(self): def __init__(self):
@ -370,7 +370,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, p44") self.window.set_title("Free Poker DB - version: alpha1+, p45")
self.window.set_border_width(1) self.window.set_border_width(1)
self.window.set_size_request(1020,400) self.window.set_size_request(1020,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

@ -47,7 +47,7 @@ class fpdb_db:
try: try:
self.cursor.execute("SELECT * FROM Settings") self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone() settings=self.cursor.fetchone()
if settings[0]!=44: if settings[0]!=45:
print "outdated or too new database version - please recreate tables" print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError: except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables" print "failed to read settings table - please recreate tables"
@ -337,7 +337,7 @@ class fpdb_db:
riverCheckCallRaiseChance INT, riverCheckCallRaiseChance INT,
riverCheckCallRaiseDone INT)""") riverCheckCallRaiseDone INT)""")
self.cursor.execute("INSERT INTO Settings VALUES (44);") self.cursor.execute("INSERT INTO Settings VALUES (45);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');") self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');") self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.cursor.execute("INSERT INTO TourneysGametypes (id) VALUES (DEFAULT);") self.cursor.execute("INSERT INTO TourneysGametypes (id) VALUES (DEFAULT);")

View File

@ -57,7 +57,9 @@ def mainParser(db, cursor, site, category, hand):
seatLines.append(hand[i]) seatLines.append(hand[i])
names=fpdb_simple.parseNames(seatLines) names=fpdb_simple.parseNames(seatLines)
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID) playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
startCashes=fpdb_simple.parseCashes(seatLines, site) tmp=fpdb_simple.parseCashesAndSeatNos(seatLines, site)
startCashes=tmp['startCashes']
seatNos=tmp['seatNos']
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo) fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo)
@ -118,7 +120,7 @@ def mainParser(db, cursor, site, category, hand):
prizepool=-1 prizepool=-1
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName) siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif (category=="razz" or category=="studhi" or category=="studhilo"): elif (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz are currently broken") raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee, result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
@ -128,7 +130,7 @@ def mainParser(db, cursor, site, category, hand):
actionTypes, actionAmounts, hudImportData) actionTypes, actionAmounts, hudImportData)
else: else:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName) result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif (category=="razz" or category=="studhi" or category=="studhilo"): elif (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz are currently broken") raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID, result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,

View File

@ -37,7 +37,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
return site_hand_no return site_hand_no
#end def ring_stud #end def ring_stud
def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData, maxSeats, tableName): def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
"""stores a holdem/omaha hand into the database""" """stores a holdem/omaha hand into the database"""
#fill up the two player card arrays #fill up the two player card arrays
@ -52,8 +52,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName) hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos)
start_cashes, positions, card_values, card_suits, winnings, rakes)
fpdb_simple.storeHudData(cursor, category, gametype_id, player_ids, hudImportData) fpdb_simple.storeHudData(cursor, category, gametype_id, player_ids, hudImportData)

View File

@ -718,24 +718,24 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo
raise FpdbError ("unrecognised line:"+line) raise FpdbError ("unrecognised line:"+line)
#end def parseCardLine #end def parseCardLine
#parses the start cash of each player out of the given lines and returns them as an array def parseCashesAndSeatNos(lines, site):
def parseCashes(lines, site): """parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
result = [] cashes = []
seatNos = []
for i in range (len(lines)): for i in range (len(lines)):
pos2=lines[i].rfind(":")
seatNos.append(int(lines[i][5:pos2]))
pos1=lines[i].rfind("($")+2 pos1=lines[i].rfind("($")+2
if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above
pos1=lines[i].rfind("(")+1 pos1=lines[i].rfind("(")+1
#print "parseCashes, lines[i]:",lines[i]
#print "parseCashes, pos1:",pos1
if (site=="ftp"): if (site=="ftp"):
pos2=lines[i].rfind(")") pos2=lines[i].rfind(")")
elif (site=="ps"): elif (site=="ps"):
#print "in parseCashes, line:", lines[i]
pos2=lines[i].find(" in chips") pos2=lines[i].find(" in chips")
#print "in parseCashes, line:", lines[i], "pos1:",pos1,"pos2:",pos2 cashes.append(float2int(lines[i][pos1:pos2]))
result.append(float2int(lines[i][pos1:pos2])) return {'startCashes':cashes, 'seatNos':seatNos}
return result #end def parseCashesAndSeatNos
#end def parseCashes
#returns the buyin of a tourney in cents #returns the buyin of a tourney in cents
def parseFee(topline): def parseFee(topline):
@ -1132,18 +1132,18 @@ def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableN
#end def storeHands #end def storeHands
def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
start_cashes, positions, card_values, card_suits, winnings, rakes): start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos):
result=[] result=[]
if (category=="holdem"): if (category=="holdem"):
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute (""" cursor.execute ("""
INSERT INTO HandsPlayers INSERT INTO HandsPlayers
(handId, playerId, startCash, position, (handId, playerId, startCash, position,
card1Value, card1Suit, card2Value, card2Suit, winnings, rake) card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1], card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i])) winnings[i], rakes[i], seatNos[i]))
cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i])) cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0]) result.append(cursor.fetchall()[0][0])
elif (category=="omahahi" or category=="omahahilo"): elif (category=="omahahi" or category=="omahahilo"):
@ -1151,12 +1151,12 @@ def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
cursor.execute ("""INSERT INTO HandsPlayers cursor.execute ("""INSERT INTO HandsPlayers
(handId, playerId, startCash, position, (handId, playerId, startCash, position,
card1Value, card1Suit, card2Value, card2Suit, card1Value, card1Suit, card2Value, card2Suit,
card3Value, card3Suit, card4Value, card4Suit, winnings, rake) card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1], card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3], card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
winnings[i], rakes[i])) winnings[i], rakes[i], seatNo[i]))
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i])) cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0]) result.append(cursor.fetchall()[0][0])
else: else: