* added a call to the import_parameter 'saveActions' in Hand.py, saving it's value in the variable Hand.saveActions

* added logic to Hand.import() so that it only calls db.storeHandsActions if saveActions is true
* added logic to DetailedStats.getstats() so that it only calls assembleHandsActions() if saveActions is true
This commit is contained in:
Chaz 2010-09-28 17:17:15 -04:00
parent 030a15f041
commit 0e9fb62b0d
2 changed files with 4 additions and 18 deletions

View File

@ -23,13 +23,6 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("parser")
DEBUG = False
if DEBUG:
import pprint
pp = pprint.PrettyPrinter(indent=4)
class DerivedStats():
def __init__(self, hand):
self.hand = hand
@ -93,17 +86,9 @@ class DerivedStats():
self.assembleHands(self.hand)
self.assembleHandsPlayers(self.hand)
if DEBUG:
if self.hand.saveActions:
self.assembleHandsActions(self.hand)
if DEBUG:
#print "Hands:"
#pp.pprint(self.hands)
#print "HandsPlayers:"
#pp.pprint(self.handsplayers)
print "HandsActions:"
pp.pprint(self.handsactions)
def getHands(self):
return self.hands

View File

@ -56,6 +56,7 @@ class Hand(object):
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
#log.debug( _("Hand.init(): handText is ") + str(handText) )
self.config = config
self.saveActions = self.config.get_import_parameters().get('saveActions')
#log = Configuration.get_logger("logging.conf", "db", log_dir=self.config.dir_log)
self.sitename = sitename
self.siteId = self.config.get_site_id(sitename)
@ -267,8 +268,8 @@ db: a connected Database object"""
self.dbid_hands = db.storeHand(hh)
self.dbid_hpid = db.storeHandsPlayers(self.dbid_hands, self.dbid_pids,
self.stats.getHandsPlayers(), printdata = printtest)
db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.dbid_hpid,
if self.saveActions:
db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.dbid_hpid,
self.stats.getHandsActions(), printdata = printtest)
else:
log.info(_("Hand.insert(): hid #: %s is a duplicate") % hh['siteHandNo'])