From fdf4b65136f8e0d1c7f9cde859bb3de759ca33cd Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 9 Jun 2009 22:55:18 +0100 Subject: [PATCH] pass all settings through so that a new one can be used to skip updating hudcache (not used yet) --- pyfpdb/fpdb_import.py | 2 +- pyfpdb/fpdb_save_to_db.py | 36 ++++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 99330bb9..3fa20b40 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -394,7 +394,7 @@ class Importer: self.hand=hand try: - handsId = fpdb_parse_logic.mainParser(self.settings['db-backend'], self.fdb.db + handsId = fpdb_parse_logic.mainParser(self.settings, self.fdb.db ,self.fdb.cursor, self.siteIds[site], category, hand, self.config) self.fdb.db.commit() diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py index e612a166..b6e8686c 100644 --- a/pyfpdb/fpdb_save_to_db.py +++ b/pyfpdb/fpdb_save_to_db.py @@ -34,11 +34,12 @@ saveActions = True # set this to False to avoid storing action data # variance not available on stats page # : No graphs #stores a stud/razz hand into the database -def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametype_id, hand_start_time +def ring_stud(config, settings, db, cursor, base, category, site_hand_no, gametype_id, hand_start_time ,names, player_ids, start_cashes, antes, card_values, card_suits, winnings, rakes ,action_types, allIns, action_amounts, actionNos, hudImportData, maxSeats, tableName ,seatNos): + backend = settings['db-backend'] import_options = config.get_import_parameters() saveActions = False if import_options['saveActions'] == False else True @@ -54,7 +55,8 @@ def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametyp ,start_cashes, antes, card_values ,card_suits, winnings, rakes, seatNos) - fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) + if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': + fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) if saveActions: fpdb_simple.storeActions(cursor, hands_players_ids, action_types @@ -62,12 +64,13 @@ def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametyp return hands_id #end def ring_stud -def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, gametype_id +def ring_holdem_omaha(config, settings, db, cursor, base, 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, allIns ,action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos): """stores a holdem/omaha hand into the database""" + backend = settings['db-backend'] import_options = config.get_import_parameters() saveActions = False if import_options['saveActions'] == False else True fastStoreHudCache = True if import_options['fastStoreHudCache'] == True else False @@ -90,10 +93,11 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, , positions, card_values, card_suits, winnings, rakes, seatNos, hudImportData) t4 = time() #print "ring holdem, backend=%d" % backend - if fastStoreHudCache: - fpdb_simple.storeHudCache2(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) - else: - fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) + if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': + if fastStoreHudCache: + fpdb_simple.storeHudCache2(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) + else: + fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) t5 = time() fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits) t6 = time() @@ -104,7 +108,7 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, return hands_id #end def ring_holdem_omaha -def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourneyNo, buyin, fee, knockout +def tourney_holdem_omaha(config, settings, db, cursor, base, category, siteTourneyNo, buyin, fee, knockout ,entries, prizepool, tourney_start, payin_amounts, ranks, tourneyTypeId ,siteId #end of tourney specific params ,site_hand_no, gametype_id, hand_start_time, names, player_ids @@ -113,6 +117,7 @@ def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourne ,actionNos, hudImportData, maxSeats, tableName, seatNos): """stores a tourney holdem/omaha hand into the database""" + backend = settings['db-backend'] import_options = config.get_import_parameters() saveActions = True if import_options['saveActions'] == True else False fastStoreHudCache = True if import_options['fastStoreHudCache'] == True else False @@ -131,10 +136,11 @@ def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourne , card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids) #print "tourney holdem, backend=%d" % backend - if fastStoreHudCache: - fpdb_simple.storeHudCache2(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) - else: - fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) + if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': + if fastStoreHudCache: + fpdb_simple.storeHudCache2(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) + else: + fpdb_simple.storeHudCache(backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits) @@ -143,13 +149,14 @@ def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourne return hands_id #end def tourney_holdem_omaha -def tourney_stud(config, backend, db, cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries +def tourney_stud(config, settings, db, 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 + backend = settings['db-backend'] import_options = config.get_import_parameters() saveActions = True if import_options['saveActions'] == True else False fastStoreHudCache = True if import_options['fastStoreHudCache'] == True else False @@ -166,7 +173,8 @@ def tourney_stud(config, backend, db, cursor, base, category, siteTourneyNo, buy , playerIds, startCashes, antes, cardValues, cardSuits , winnings, rakes, seatNos, tourneys_players_ids) - fpdb_simple.storeHudCache(backend, cursor, base, category, gametypeId, hand_start_time, playerIds, hudImportData) + if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': + fpdb_simple.storeHudCache(backend, cursor, base, category, gametypeId, hand_start_time, playerIds, hudImportData) if saveActions: fpdb_simple.storeActions(cursor, hands_players_ids, actionTypes, allIns, actionAmounts, actionNos)