TOURNEY: store HandsPlayers.tourneysPlayersId

This commit is contained in:
steffen123 2010-07-15 00:27:57 +02:00
parent 6a8f3ff68b
commit ebf16c6aa9
3 changed files with 10 additions and 5 deletions

View File

@ -1657,6 +1657,7 @@ class Database:
pdata[p]['street4Bets'], pdata[p]['street4Bets'],
pdata[p]['position'], pdata[p]['position'],
pdata[p]['tourneyTypeId'], pdata[p]['tourneyTypeId'],
pdata[p]['tourneysPlayersIds'],
pdata[p]['startCards'], pdata[p]['startCards'],
pdata[p]['street0_3BChance'], pdata[p]['street0_3BChance'],
pdata[p]['street0_3BDone'], pdata[p]['street0_3BDone'],
@ -2074,7 +2075,7 @@ class Database:
#end def createOrUpdateTourney #end def createOrUpdateTourney
def createOrUpdateTourneysPlayers(self, hand, source):#note: this method is used on Hand and TourneySummary objects def createOrUpdateTourneysPlayers(self, hand, source):#note: this method is used on Hand and TourneySummary objects
tourneysPlayersIds=[] tourneysPlayersIds={}
for player in hand.players: for player in hand.players:
if source=="TS": #TODO remove this horrible hack if source=="TS": #TODO remove this horrible hack
playerId = hand.dbid_pids[player] playerId = hand.dbid_pids[player]
@ -2094,9 +2095,8 @@ class Database:
updateDb=False updateDb=False
resultDict = dict(zip(columnNames, result)) resultDict = dict(zip(columnNames, result))
tourneysPlayersIds.append(result[0]) tourneysPlayersIds[player[1]]=result[0]
if source=="TS": if source=="TS":
tourneysPlayersId=result[0]
for ev in expectedValues : for ev in expectedValues :
handAttribute=ev handAttribute=ev
if ev!="winnings" and ev!="winningsCurrency": if ev!="winnings" and ev!="winningsCurrency":
@ -2124,7 +2124,7 @@ class Database:
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']), cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, None, None, None, (hand.tourneyId, playerId, None, None, None,
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player])) hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
tourneysPlayersIds.append(self.get_last_insert_id(cursor)) tourneysPlayersIds[player[1]]=self.get_last_insert_id(cursor)
return tourneysPlayersIds return tourneysPlayersIds
#end def createOrUpdateTourneysPlayers #end def createOrUpdateTourneysPlayers

View File

@ -140,6 +140,10 @@ class DerivedStats():
self.handsplayers[player[1]]['seatNo'] = player[0] self.handsplayers[player[1]]['seatNo'] = player[0]
self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2]))
self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection
if hand.gametype["type"]=="tour":
self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]]
else:
self.handsplayers[player[1]]['tourneysPlayersIds'] = None
# XXX: enumerate(list, start=x) is python 2.6 syntax; 'start' # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
#for i, street in enumerate(hand.actionStreets[2:], start=1): #for i, street in enumerate(hand.actionStreets[2:], start=1):

View File

@ -3853,6 +3853,7 @@ class Sql:
street4Bets, street4Bets,
position, position,
tourneyTypeId, tourneyTypeId,
tourneysPlayersId,
startCards, startCards,
street0_3BChance, street0_3BChance,
street0_3BDone, street0_3BDone,
@ -3910,7 +3911,7 @@ class Sql:
%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,
%s %s, %s
)""" )"""
################################ ################################