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:
parent
14eb29f702
commit
96664d009c
|
@ -185,17 +185,22 @@ def import_file_dict(options, settings, callHud=False):
|
|||
startpos=endpos
|
||||
print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
|
||||
|
||||
if stored==0 and duplicates>0:
|
||||
for line_no in range(len(lines)):
|
||||
if lines[line_no].find("Game #")!=-1:
|
||||
final_game_line=lines[line_no]
|
||||
handsId=fpdb_simple.parseSiteHandNo(final_game_line)
|
||||
#todo: this will cause return of an unstored hand number if the last hadn was error or partial
|
||||
if stored==0:
|
||||
if duplicates>0:
|
||||
for line_no in range(len(lines)):
|
||||
if lines[line_no].find("Game #")!=-1:
|
||||
final_game_line=lines[line_no]
|
||||
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()
|
||||
inputFile.close()
|
||||
cursor.close()
|
||||
db.close()
|
||||
return handsId
|
||||
#end def import_file_dict
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -114,7 +114,7 @@ def mainParser(db, cursor, site, category, hand):
|
|||
tableName=tableResult['tableName']
|
||||
#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.
|
||||
fpdb_simple.convertCardValues(cardValues)
|
||||
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,
|
||||
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
|
||||
elif base=="stud":
|
||||
result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee,
|
||||
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
|
||||
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
|
||||
startCashes, antes, cardValues, cardSuits, winnings, rakes,
|
||||
actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
|
||||
result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
|
||||
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
|
||||
else:
|
||||
raise fpdb_simple.FpdbError ("unrecognised category")
|
||||
else:
|
||||
|
|
|
@ -74,25 +74,21 @@ def tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knoc
|
|||
return hands_id
|
||||
#end def tourney_holdem_omaha
|
||||
|
||||
def tourney_stud(cursor, base, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
|
||||
tourney_start, payin_amounts, ranks, #end of tourney specific params
|
||||
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):
|
||||
def tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteId,
|
||||
siteHandNo, gametypeId, handStartTime, names, playerIds, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
|
||||
#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,
|
||||
start_cashes, antes, card_values, card_suits, winnings, rakes, tourneys_players_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)
|
||||
|
||||
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
|
||||
#end def tourney_stud
|
||||
|
|
|
@ -1334,24 +1334,24 @@ def store_hands_players_holdem_omaha_tourney(cursor, category, hands_id, player_
|
|||
#end def store_hands_players_holdem_omaha_tourney
|
||||
|
||||
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
|
||||
result=[]
|
||||
for i in range (len(player_ids)):
|
||||
cursor.execute ("""INSERT INTO HandsPlayers
|
||||
(hand_id, player_id, player_startcash, ante,
|
||||
card1_value, card1_suit, card2_value, card2_suit,
|
||||
card3_value, card3_suit, card4_value, card4_suit,
|
||||
card5_value, card5_suit, card6_value, card6_suit,
|
||||
card7_value, card7_suit, winnings, rake, tourneys_players_id)
|
||||
(handId, playerId, startCash, ante,
|
||||
card1Value, card1Suit, card2Value, card2Suit,
|
||||
card3Value, card3Suit, card4Value, card4Suit,
|
||||
card5Value, card5Suit, card6Value, card6Suit,
|
||||
card7Value, card7Suit, winnings, rake, tourneysPlayersId, seatNo)
|
||||
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],
|
||||
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][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]))
|
||||
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_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 HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
|
||||
result.append(cursor.fetchall()[0][0])
|
||||
return result
|
||||
#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):
|
||||
myStreet3Seen=True
|
||||
|
||||
print "base:", base
|
||||
#print "base:", base
|
||||
if base=="hold":
|
||||
mySawShowdown=True
|
||||
for count in range (len(action_types[3][player])):
|
||||
if action_types[3][player][count]=="fold":
|
||||
mySawShowdown=False
|
||||
else:
|
||||
print "in else"
|
||||
#print "in else"
|
||||
for i in range(len(allIns[3][player])):
|
||||
if allIns[3][player][i]:
|
||||
isAllIn=True
|
||||
if (len(action_types[4][player])>0 or isAllIn):
|
||||
print "in if"
|
||||
#print "in if"
|
||||
myStreet4Seen=True
|
||||
|
||||
mySawShowdown=True
|
||||
|
|
Loading…
Reference in New Issue
Block a user