[NEWIMPORT] Insert winnings column into HandsPlayers
This commit is contained in:
parent
bea6bf2d6b
commit
5aef7b6054
|
@ -1393,6 +1393,7 @@ class Database:
|
|||
pids[p],
|
||||
pdata[p]['startCash'],
|
||||
pdata[p]['seatNo'],
|
||||
pdata[p]['winnings'],
|
||||
pdata[p]['street0Aggr'],
|
||||
pdata[p]['street1Aggr'],
|
||||
pdata[p]['street2Aggr'],
|
||||
|
@ -1405,6 +1406,7 @@ class Database:
|
|||
playerId,
|
||||
startCash,
|
||||
seatNo,
|
||||
winnings,
|
||||
street0Aggr,
|
||||
street1Aggr,
|
||||
street2Aggr,
|
||||
|
@ -1413,7 +1415,7 @@ class Database:
|
|||
)
|
||||
VALUES (
|
||||
%s, %s, %s, %s, %s,
|
||||
%s, %s, %s, %s
|
||||
%s, %s, %s, %s, %s
|
||||
)"""
|
||||
|
||||
# position,
|
||||
|
@ -1423,7 +1425,6 @@ class Database:
|
|||
# card3,
|
||||
# card4,
|
||||
# startCards,
|
||||
# winnings,
|
||||
# rake,
|
||||
# totalProfit,
|
||||
# street0VPI,
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
#fpdb modules
|
||||
import Card
|
||||
|
||||
DEBUG = True
|
||||
|
||||
if DEBUG:
|
||||
import pprint
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
|
||||
|
||||
class DerivedStats():
|
||||
def __init__(self, hand):
|
||||
self.hand = hand
|
||||
|
@ -30,13 +37,17 @@ class DerivedStats():
|
|||
for player in hand.players:
|
||||
self.handsplayers[player[1]] = {}
|
||||
#Init vars that may not be used, but still need to be inserted.
|
||||
self.handsplayers[player[1]]['winnings'] = 0
|
||||
self.handsplayers[player[1]]['street4Aggr'] = False
|
||||
|
||||
self.assembleHands(self.hand)
|
||||
self.assembleHandsPlayers(self.hand)
|
||||
|
||||
print "hands =", self.hands
|
||||
print "handsplayers =", self.handsplayers
|
||||
if DEBUG:
|
||||
print "Hands:"
|
||||
pp.pprint(self.hands)
|
||||
print "HandsPlayers:"
|
||||
pp.pprint(self.handsplayers)
|
||||
|
||||
def getHands(self):
|
||||
return self.hands
|
||||
|
@ -90,6 +101,11 @@ class DerivedStats():
|
|||
self.handsplayers[player[1]]['seatNo'] = player[0]
|
||||
self.handsplayers[player[1]]['startCash'] = player[2]
|
||||
|
||||
# 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:
|
||||
self.handsplayers[player]['winnings'] = int(100 * hand.collectees[player])
|
||||
|
||||
for i, street in enumerate(hand.actionStreets[1:]):
|
||||
self.aggr(self.hand, i)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user