* 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:
parent
030a15f041
commit
0e9fb62b0d
|
@ -23,13 +23,6 @@ import logging
|
||||||
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
||||||
log = logging.getLogger("parser")
|
log = logging.getLogger("parser")
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
|
|
||||||
if DEBUG:
|
|
||||||
import pprint
|
|
||||||
pp = pprint.PrettyPrinter(indent=4)
|
|
||||||
|
|
||||||
|
|
||||||
class DerivedStats():
|
class DerivedStats():
|
||||||
def __init__(self, hand):
|
def __init__(self, hand):
|
||||||
self.hand = hand
|
self.hand = hand
|
||||||
|
@ -93,17 +86,9 @@ class DerivedStats():
|
||||||
self.assembleHands(self.hand)
|
self.assembleHands(self.hand)
|
||||||
self.assembleHandsPlayers(self.hand)
|
self.assembleHandsPlayers(self.hand)
|
||||||
|
|
||||||
if DEBUG:
|
if self.hand.saveActions:
|
||||||
self.assembleHandsActions(self.hand)
|
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):
|
def getHands(self):
|
||||||
return self.hands
|
return self.hands
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ class Hand(object):
|
||||||
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
|
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
|
||||||
#log.debug( _("Hand.init(): handText is ") + str(handText) )
|
#log.debug( _("Hand.init(): handText is ") + str(handText) )
|
||||||
self.config = config
|
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)
|
#log = Configuration.get_logger("logging.conf", "db", log_dir=self.config.dir_log)
|
||||||
self.sitename = sitename
|
self.sitename = sitename
|
||||||
self.siteId = self.config.get_site_id(sitename)
|
self.siteId = self.config.get_site_id(sitename)
|
||||||
|
@ -267,7 +268,7 @@ db: a connected Database object"""
|
||||||
self.dbid_hands = db.storeHand(hh)
|
self.dbid_hands = db.storeHand(hh)
|
||||||
self.dbid_hpid = db.storeHandsPlayers(self.dbid_hands, self.dbid_pids,
|
self.dbid_hpid = db.storeHandsPlayers(self.dbid_hands, self.dbid_pids,
|
||||||
self.stats.getHandsPlayers(), printdata = printtest)
|
self.stats.getHandsPlayers(), printdata = printtest)
|
||||||
|
if self.saveActions:
|
||||||
db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.dbid_hpid,
|
db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.dbid_hpid,
|
||||||
self.stats.getHandsActions(), printdata = printtest)
|
self.stats.getHandsActions(), printdata = printtest)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user