From a87a145c28031d517b74b98162129619dffe1432 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 25 Nov 2009 00:57:14 +0800 Subject: [PATCH] [NEWIMPORT] HandsPlayers.streetXCalls and streetXBets Pretty sure the bets stat is wrong --- pyfpdb/Database.py | 36 ++++++++++++++++++++++++------------ pyfpdb/DerivedStats.py | 20 +++++++++++++++++++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 9bfe9dd6..9f214aeb 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1409,7 +1409,17 @@ class Database: pdata[p]['street2Aggr'], pdata[p]['street3Aggr'], pdata[p]['street4Aggr'], - pdata[p]['wonWhenSeenStreet1'] + pdata[p]['wonWhenSeenStreet1'], + pdata[p]['street0Calls'], + pdata[p]['street1Calls'], + pdata[p]['street2Calls'], + pdata[p]['street3Calls'], + pdata[p]['street4Calls'], + pdata[p]['street0Bets'], + pdata[p]['street1Bets'], + pdata[p]['street2Bets'], + pdata[p]['street3Bets'], + pdata[p]['street4Bets'], ) ) q = """INSERT INTO HandsPlayers ( @@ -1439,7 +1449,17 @@ class Database: street2Aggr, street3Aggr, street4Aggr, - wonWhenSeenStreet1 + wonWhenSeenStreet1, + street0Calls, + street1Calls, + street2Calls, + street3Calls, + street4Calls, + street0Bets, + street1Bets, + street2Bets, + street3Bets, + street4Bets ) VALUES ( %s, %s, @@ -1447,6 +1467,8 @@ class Database: %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, + %s, %s, %s, %s, %s, + %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )""" @@ -1493,16 +1515,6 @@ class Database: # street3CheckCallRaiseDone, # street4CheckCallRaiseChance, # street4CheckCallRaiseDone, -# street0Calls, -# street1Calls, -# street2Calls, -# street3Calls, -# street4Calls, -# street0Bets, -# street1Bets, -# street2Bets, -# street3Bets, -# street4Bets q = q.replace('%s', self.sql.query['placeholder']) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index fabadb3b..3da670cc 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -46,6 +46,9 @@ class DerivedStats(): self.handsplayers[player[1]]['wonWhenSeenStreet1'] = False self.handsplayers[player[1]]['sawShowdown'] = False self.handsplayers[player[1]]['wonAtSD'] = False + for i in range(5): + self.handsplayers[player[1]]['street%dCalls' % i] = 0 + self.handsplayers[player[1]]['street%dBets' % i] = 0 self.assembleHands(self.hand) self.assembleHandsPlayers(self.hand) @@ -114,6 +117,8 @@ class DerivedStats(): for i, street in enumerate(hand.actionStreets[1:]): self.aggr(self.hand, i) + self.calls(self.hand, i) + self.bets(self.hand, i) # Winnings is a non-negative value of money collected from the pot, which already includes the # rake taken out. hand.collectees is Decimal, database requires cents @@ -132,7 +137,6 @@ class DerivedStats(): for player in hand.pot.committed: self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])) - #default_holecards = ["Xx", "Xx", "Xx", "Xx"] #if hand.gametype['base'] == "hold": # pass @@ -240,6 +244,20 @@ class DerivedStats(): else: self.handsplayers[player[1]]['street%sAggr' % i] = False + def calls(self, hand, i): + callers = [] + for act in hand.actions[hand.actionStreets[i+1]]: + if act[1] in ('calls'): + self.handsplayers[act[0]]['street%sCalls' % i] = 1 + self.handsplayers[act[0]]['street%sCalls' % i] + + # CG - I'm sure this stat is wrong + # Best guess is that raise = 2 bets + def bets(self, hand, i): + betters = [] + for act in hand.actions[hand.actionStreets[i+1]]: + if act[1] in ('bets'): + self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i] + def countPlayers(self, hand): pass