p130 - stud/razz tourneys run again, but completely unverified (like holdem/omaha tourneys

changed fpdb_import slightly to not die if a file had 0 stored hands
This commit is contained in:
steffen123 2008-10-09 07:17:18 +01:00
parent 14eb29f702
commit 96664d009c
4 changed files with 35 additions and 37 deletions

View File

@ -185,17 +185,22 @@ def import_file_dict(options, settings, callHud=False):
startpos=endpos startpos=endpos
print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
if stored==0 and duplicates>0: if stored==0:
for line_no in range(len(lines)): if duplicates>0:
if lines[line_no].find("Game #")!=-1: for line_no in range(len(lines)):
final_game_line=lines[line_no] if lines[line_no].find("Game #")!=-1:
handsId=fpdb_simple.parseSiteHandNo(final_game_line) final_game_line=lines[line_no]
#todo: this will cause return of an unstored hand number if the last hadn was error or partial handsId=fpdb_simple.parseSiteHandNo(final_game_line)
else:
print "failed to read a single hand from file:", inputFile
handsId=0
#todo: this will cause return of an unstored hand number if the last hand was error or partial
db.commit() db.commit()
inputFile.close() inputFile.close()
cursor.close() cursor.close()
db.close() db.close()
return handsId return handsId
#end def import_file_dict
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -114,7 +114,7 @@ def mainParser(db, cursor, site, category, hand):
tableName=tableResult['tableName'] tableName=tableResult['tableName']
#print "before part5, antes:", antes #print "before part5, antes:", antes
#part 5: final preparations, then call fpdb_save_to_db.saveHoldem with #part 5: final preparations, then call fpdb_save_to_db.* with
# the arrays as they are - that file will fill them. # the arrays as they are - that file will fill them.
fpdb_simple.convertCardValues(cardValues) fpdb_simple.convertCardValues(cardValues)
if base=="hold": if base=="hold":
@ -145,11 +145,8 @@ def mainParser(db, cursor, site, category, hand):
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID, result = fpdb_save_to_db.tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif base=="stud": elif base=="stud":
result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
startCashes, antes, cardValues, cardSuits, winnings, rakes,
actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else: else:
raise fpdb_simple.FpdbError ("unrecognised category") raise fpdb_simple.FpdbError ("unrecognised category")
else: else:

View File

@ -74,25 +74,21 @@ def tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knoc
return hands_id return hands_id
#end def tourney_holdem_omaha #end def tourney_holdem_omaha
def tourney_stud(cursor, base, category, site_tourney_no, buyin, fee, knockout, entries, prizepool, def tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteId,
tourney_start, payin_amounts, ranks, #end of tourney specific params siteHandNo, gametypeId, handStartTime, names, playerIds, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes,
action_types, allIns, action_amounts, hudImportData):
#stores a tourney stud/razz hand into the database #stores a tourney stud/razz hand into the database
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) fpdb_simple.fillCardArrays(len(names), base, category, cardValues, cardSuits)
tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start) tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime)
tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings) tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, playerIds, payin_amounts, ranks, winnings)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names) hands_id=fpdb_simple.storeHands(cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, player_ids, hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, playerIds, startCashes, antes, cardValues, cardSuits, winnings, rakes, seatNos, tourneys_players_ids)
start_cashes, antes, card_values, card_suits, winnings, rakes, tourneys_players_ids)
fpdb_simple.storeHudData(cursor, base, category, player_ids, hudImportData) fpdb_simple.storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts) fpdb_simple.storeActions(cursor, hands_players_ids, actionTypes, allIns, actionAmounts, actionNos)
return hands_id return hands_id
#end def tourney_stud #end def tourney_stud

View File

@ -1334,24 +1334,24 @@ def store_hands_players_holdem_omaha_tourney(cursor, category, hands_id, player_
#end def store_hands_players_holdem_omaha_tourney #end def store_hands_players_holdem_omaha_tourney
def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes, def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
antes, card_values, card_suits, winnings, rakes, tourneys_players_ids): antes, card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids):
#stores hands_players for tourney stud/razz hands #stores hands_players for tourney stud/razz hands
result=[] result=[]
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute ("""INSERT INTO HandsPlayers cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash, ante, (handId, playerId, startCash, ante,
card1_value, card1_suit, card2_value, card2_suit, card1Value, card1Suit, card2Value, card2Suit,
card3_value, card3_suit, card4_value, card4_suit, card3Value, card3Suit, card4Value, card4Suit,
card5_value, card5_suit, card6_value, card6_suit, card5Value, card5Suit, card6Value, card6Suit,
card7_value, card7_suit, winnings, rake, tourneys_players_id) card7Value, card7Suit, winnings, rake, tourneysPlayersId, seatNo)
VALUES (%s, %s, %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, %s,
%s, %s, %s, %s, %s)""", %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], antes[i], (hands_id, player_ids[i], start_cashes[i], antes[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],
card_values[i][4], card_suits[i][4], card_values[i][5], card_suits[i][5], card_values[i][4], card_suits[i][4], card_values[i][5], card_suits[i][5],
card_values[i][6], card_suits[i][6], winnings[i], rakes[i], tourneys_players_ids[i])) card_values[i][6], card_suits[i][6], winnings[i], rakes[i], tourneys_players_ids[i], seatNos[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 HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0]) result.append(cursor.fetchall()[0][0])
return result return result
#end def store_hands_players_stud_tourney #end def store_hands_players_stud_tourney
@ -1526,19 +1526,19 @@ def generateHudCacheData(player_ids, base, category, action_types, allIns, actio
if (len(action_types[3][player])>0 or isAllIn): if (len(action_types[3][player])>0 or isAllIn):
myStreet3Seen=True myStreet3Seen=True
print "base:", base #print "base:", base
if base=="hold": if base=="hold":
mySawShowdown=True mySawShowdown=True
for count in range (len(action_types[3][player])): for count in range (len(action_types[3][player])):
if action_types[3][player][count]=="fold": if action_types[3][player][count]=="fold":
mySawShowdown=False mySawShowdown=False
else: else:
print "in else" #print "in else"
for i in range(len(allIns[3][player])): for i in range(len(allIns[3][player])):
if allIns[3][player][i]: if allIns[3][player][i]:
isAllIn=True isAllIn=True
if (len(action_types[4][player])>0 or isAllIn): if (len(action_types[4][player])>0 or isAllIn):
print "in if" #print "in if"
myStreet4Seen=True myStreet4Seen=True
mySawShowdown=True mySawShowdown=True