fpdb_save_to_db: minor cleanup

This commit is contained in:
eblade 2009-03-18 17:15:21 -04:00
parent a424a9c77d
commit 1b626271ee

View File

@ -22,13 +22,13 @@ from time import time
import fpdb_simple
MYSQL_INNODB=2
PGSQL=3
SQLITE=4
MYSQL_INNODB = 2
PGSQL = 3
SQLITE = 4
fastStoreHudCache=True # set this to True to test the new storeHudCache routine
fastStoreHudCache = True # set this to True to test the new storeHudCache routine
saveActions=False # set this to False to avoid storing action data
saveActions = False # set this to False to avoid storing action data
# Pros: speeds up imports
# Cons: no action data is saved, so you need to keep the hand histories
# variance not available on stats page
@ -40,22 +40,17 @@ def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametyp
,seatNos):
import_options = config.get_import_parameters()
if import_options['saveActions'] == 'True':
saveActions = True
else:
saveActions = False
if import_options['fastStoreHudCache'] == 'True':
fastStoreHudCache = True
else:
fastStoreHudCache = False
saveActions = True if import_options['saveActions'] == 'True' else False
fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
,hand_start_time, names, tableName, maxSeats)
#print "before calling store_hands_players_stud, antes:", antes
hands_players_ids=fpdb_simple.store_hands_players_stud(backend, db, cursor, hands_id, player_ids
hands_players_ids = fpdb_simple.store_hands_players_stud(backend, db, cursor, hands_id, player_ids
,start_cashes, antes, card_values
,card_suits, winnings, rakes, seatNos)
@ -74,14 +69,8 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no,
"""stores a holdem/omaha hand into the database"""
import_options = config.get_import_parameters()
if import_options['saveActions'] == 'True':
saveActions = True
else:
saveActions = False
if import_options['fastStoreHudCache'] == 'True':
fastStoreHudCache = True
else:
fastStoreHudCache = False
saveActions = True if import_options['saveActions'] == 'True' else False
fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False
t0 = time()
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
@ -89,10 +78,10 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no,
fpdb_simple.fill_board_cards(board_values, board_suits)
t2 = time()
hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
,hand_start_time, names, tableName, maxSeats)
t3 = time()
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(
hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha(
backend, db, cursor, category, hands_id, player_ids, start_cashes
, positions, card_values, card_suits, winnings, rakes, seatNos)
t4 = time()
@ -121,25 +110,19 @@ def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourne
"""stores a tourney holdem/omaha hand into the database"""
import_options = config.get_import_parameters()
if import_options['saveActions'] == 'True':
saveActions = True
else:
saveActions = False
if import_options['fastStoreHudCache'] == 'True':
fastStoreHudCache = True
else:
fastStoreHudCache = False
saveActions = True if import_options['saveActions'] == 'True' else False
fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
fpdb_simple.fill_board_cards(board_values, board_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start)
tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings)
tourney_id = fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start)
tourneys_players_ids = fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings)
hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id
,hand_start_time, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney(
hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha_tourney(
backend, db, cursor, category, hands_id, player_ids, start_cashes, positions
, card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids)
@ -164,24 +147,18 @@ def tourney_stud(config, backend, db, cursor, base, category, siteTourneyNo, buy
#stores a tourney stud/razz hand into the database
import_options = config.get_import_parameters()
if import_options['saveActions'] == 'True':
saveActions = True
else:
saveActions = False
if import_options['fastStoreHudCache'] == 'True':
fastStoreHudCache = True
else:
fastStoreHudCache = False
saveActions = True if import_options['saveActions'] == 'True' else False
fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False
fpdb_simple.fillCardArrays(len(names), base, category, cardValues, cardSuits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime)
tourney_id = fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime)
tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, playerIds, 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(backend, db, cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats)
hands_id = fpdb_simple.storeHands(backend, db, cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(backend, db, cursor, hands_id
hands_players_ids = fpdb_simple.store_hands_players_stud_tourney(backend, db, cursor, hands_id
, playerIds, startCashes, antes, cardValues, cardSuits
, winnings, rakes, seatNos, tourneys_players_ids)