HandsActions: Stub in the remaining calls for HandsActions

This commit is contained in:
Worros 2010-09-01 10:47:13 +08:00
parent a03e836044
commit 9a3d60e0b3
3 changed files with 30 additions and 1 deletions

View File

@ -1756,6 +1756,30 @@ class Database:
c = self.get_cursor()
c.executemany(q, inserts)
def storeHandsPlayers(self, hid, pids, adata, printdata = False):
#print "DEBUG: %s %s %s" %(hid, pids, adata)
if printdata:
import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(adata)
#inserts = []
#for p in pdata:
# inserts.append( (hid,
# pids[p],
# adata[p]['startCash'],
# adata[p]['seatNo'],
# adata[p]['sitout'],
# adata[p]['card1'],
#q = self.sql.query['store_hands_actions']
#q = q.replace('%s', self.sql.query['placeholder'])
#print "DEBUG: inserts: %s" %inserts
#print "DEBUG: q: %s" % q
#c = self.get_cursor()
#c.executemany(q, inserts)
def storeHudCache(self, gid, pids, starttime, pdata):
"""Update cached statistics. If update fails because no record exists, do an insert."""

View File

@ -36,6 +36,7 @@ class DerivedStats():
self.hands = {}
self.handsplayers = {}
self.handsactions = {}
def getStats(self, hand):
@ -107,6 +108,9 @@ class DerivedStats():
def getHandsPlayers(self):
return self.handsplayers
def getHandsActions(self):
return self.handsactions
def assembleHands(self, hand):
self.hands['tableName'] = hand.tablename
self.hands['siteHandNo'] = hand.handid

View File

@ -275,6 +275,7 @@ db: a connected Database object"""
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers(), printdata = printtest)
# TODO HandsActions - all actions for all players for all streets - self.actions
# HudCache data can be generated from HandsActions (HandsPlayers?)
#db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.stats.getHandsActions(), printdata = printtest)
else:
log.info(_("Hand.insert(): hid #: %s is a duplicate") % hh['siteHandNo'])
self.is_duplicate = True # i.e. don't update hudcache