From 006d7164eaaf567d151356062b3b54326cf20862 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 6 Nov 2009 19:13:52 +0800 Subject: [PATCH] [NEWIMPORT] Insert streetXSeen col into HandsPlayers --- pyfpdb/Database.py | 13 +++++++++---- pyfpdb/DerivedStats.py | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 38bd04cc..8a1060a6 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1394,6 +1394,10 @@ class Database: pdata[p]['startCash'], pdata[p]['seatNo'], pdata[p]['winnings'], + pdata[p]['street1Seen'], + pdata[p]['street2Seen'], + pdata[p]['street3Seen'], + pdata[p]['street4Seen'], pdata[p]['street0Aggr'], pdata[p]['street1Aggr'], pdata[p]['street2Aggr'], @@ -1407,6 +1411,10 @@ class Database: startCash, seatNo, winnings, + street1Seen, + street2Seen, + street3Seen, + street4Seen, street0Aggr, street1Aggr, street2Aggr, @@ -1414,6 +1422,7 @@ class Database: street4Aggr ) VALUES ( + %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )""" @@ -1430,10 +1439,6 @@ class Database: # street0VPI, # street0_3BChance, # street0_3BDone, -# street1Seen, -# street2Seen, -# street3Seen, -# street4Seen, # sawShowdown, # otherRaisedStreet1, # otherRaisedStreet2, diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 86aa92fb..1e23e600 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -37,7 +37,9 @@ class DerivedStats(): for player in hand.players: self.handsplayers[player[1]] = {} #Init vars that may not be used, but still need to be inserted. + # All stud street4 need this when importing holdem self.handsplayers[player[1]]['winnings'] = 0 + self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False self.assembleHands(self.hand) @@ -106,6 +108,9 @@ class DerivedStats(): for player in hand.collectees: self.handsplayers[player]['winnings'] = int(100 * hand.collectees[player]) + for i, street in enumerate(hand.actionStreets[2:]): + self.seen(self.hand, i+2) + for i, street in enumerate(hand.actionStreets[1:]): self.aggr(self.hand, i) @@ -849,6 +854,17 @@ class DerivedStats(): self.hands['street3Raises'] = 0 # /* num big bets paid to see sd/street7 */ self.hands['street4Raises'] = 0 # /* num big bets paid to see showdown */ + def seen(self, hand, i): + pas = set() + for act in hand.actions[hand.actionStreets[i]]: + pas.add(act[0]) + + for player in hand.players: + if player[1] in pas: + self.handsplayers[player[1]]['street%sSeen' % i] = True + else: + self.handsplayers[player[1]]['street%sSeen' % i] = False + def aggr(self, hand, i): aggrers = set() for act in hand.actions[hand.actionStreets[i]]: