From dc1b0d2e38df78a5e5ee0ddae8c4863525ab3ddc Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 24 Nov 2009 21:58:27 +0800 Subject: [PATCH] [NEWIMPORT] Calculate wonWhenSeenStreet1 Won is defined as 'collected money from the pot' Seen street 1 does not require vpip on street 0 --- pyfpdb/Database.py | 9 +++++---- pyfpdb/DerivedStats.py | 14 +++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 9134fc6a..ed987d81 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1406,7 +1406,8 @@ class Database: pdata[p]['street1Aggr'], pdata[p]['street2Aggr'], pdata[p]['street3Aggr'], - pdata[p]['street4Aggr'] + pdata[p]['street4Aggr'], + pdata[p]['wonWhenSeenStreet1'] ) ) q = """INSERT INTO HandsPlayers ( @@ -1433,10 +1434,11 @@ class Database: street1Aggr, street2Aggr, street3Aggr, - street4Aggr + street4Aggr, + wonWhenSeenStreet1 ) VALUES ( - %s, %s, %s, %s, + %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, @@ -1458,7 +1460,6 @@ class Database: # foldToOtherRaisedStreet2, # foldToOtherRaisedStreet3, # foldToOtherRaisedStreet4, -# wonWhenSeenStreet1, # stealAttemptChance, # stealAttempted, # foldBbToStealChance, diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 4366d067..c6b3fc64 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -43,6 +43,7 @@ class DerivedStats(): self.handsplayers[player[1]]['totalProfit'] = 0 self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False + self.handsplayers[player[1]]['wonWhenSeenStreet1'] = False self.assembleHands(self.hand) self.assembleHandsPlayers(self.hand) @@ -104,6 +105,12 @@ class DerivedStats(): self.handsplayers[player[1]]['seatNo'] = player[0] self.handsplayers[player[1]]['startCash'] = player[2] + for i, street in enumerate(hand.actionStreets[2:]): + self.seen(self.hand, i+1) + + for i, street in enumerate(hand.actionStreets[1:]): + self.aggr(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 for player in hand.collectees: @@ -113,15 +120,12 @@ class DerivedStats(): # different sites calculate rake differently. # Should be fine for split-pots, but won't be accurate for multi-way pots self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees) + if self.handsplayers[player]['street1Seen'] == True: + self.handsplayers[player]['wonWhenSeenStreet1'] = True for player in hand.pot.committed: self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])) - for i, street in enumerate(hand.actionStreets[2:]): - self.seen(self.hand, i+1) - - for i, street in enumerate(hand.actionStreets[1:]): - self.aggr(self.hand, i) #default_holecards = ["Xx", "Xx", "Xx", "Xx"] #if hand.gametype['base'] == "hold":