PS Summary now stores rank, winnings, etc. into TourneysPl.

This commit is contained in:
steffen123 2010-07-09 01:07:22 +02:00
parent 5b64ad771a
commit 310c7a2947
3 changed files with 20 additions and 7 deletions

View File

@ -2019,8 +2019,14 @@ class Database:
if result != None and len(result)==1: if result != None and len(result)==1:
tourneysPlayersIds.append(result[0]) tourneysPlayersIds.append(result[0])
else: else:
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']), if source=="HHC":
(hand.tourneyId, playerId, None, None, None, None, None, None, None, None)) cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, None, None, None, None, None, None))
elif source=="TS":
#print "all values: tourneyId",hand.tourneyId, "playerId",playerId, "rank",hand.ranks[player], "winnings",hand.winnings[player], "winCurr",hand.winningsCurrency[player], hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, int(hand.ranks[player]), int(hand.winnings[player]), hand.winningsCurrency[player],
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
tourneysPlayersIds.append(self.get_last_insert_id(cursor)) tourneysPlayersIds.append(self.get_last_insert_id(cursor))
return tourneysPlayersIds return tourneysPlayersIds
#end def createOrUpdateTourneysPlayers #end def createOrUpdateTourneysPlayers

View File

@ -3664,8 +3664,8 @@ class Sql:
""" """
self.query['insertTourneysPlayer'] = """INSERT INTO TourneysPlayers self.query['insertTourneysPlayer'] = """INSERT INTO TourneysPlayers
(tourneyId, playerId, rank, winnings, winningsCurrency, rebuyCount, addOnCount, koCount, comment, commentTs) (tourneyId, playerId, rank, winnings, winningsCurrency, rebuyCount, addOnCount, koCount)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
""" """
self.query['selectHandsPlayersWithWrongTTypeId'] = """SELECT id self.query['selectHandsPlayersWithWrongTTypeId'] = """SELECT id

View File

@ -158,6 +158,7 @@ class TourneySummary(object):
("TOURNEYS PLAYERS IDS", self.tourneysPlayersIds), ("TOURNEYS PLAYERS IDS", self.tourneysPlayersIds),
("RANKS", self.ranks), ("RANKS", self.ranks),
("WINNINGS", self.winnings), ("WINNINGS", self.winnings),
("WINNINGS CURRENCY", self.winningsCurrency),
("COUNT REBUYS", self.rebuyCounts), ("COUNT REBUYS", self.rebuyCounts),
("COUNT ADDONS", self.addOnCounts), ("COUNT ADDONS", self.addOnCounts),
("NB OF KO", self.koCounts) ("NB OF KO", self.koCounts)
@ -191,9 +192,7 @@ class TourneySummary(object):
for player in self.players: for player in self.players:
id=self.db.get_player_id(self.config, self.siteName, player) id=self.db.get_player_id(self.config, self.siteName, player)
if not id: if not id:
self.db.insertPlayer(player, self.siteId) id=self.db.insertPlayer(player, self.siteId)
id=self.db.get_last_insert_id(self.db.cursor)
self.playerIds.update({player:id}) self.playerIds.update({player:id})
#print "TS.insert players",self.players,"playerIds",self.playerIds #print "TS.insert players",self.players,"playerIds",self.playerIds
@ -236,10 +235,18 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
self.winningsCurrency.update( { name : winningsCurrency } ) self.winningsCurrency.update( { name : winningsCurrency } )
if rebuyCount: if rebuyCount:
self.rebuyCounts.update( {name: Decimal(rebuyCount) } ) self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
else:
self.rebuyCounts.update( {name: None } )
if addOnCount: if addOnCount:
self.addOnCounts.update( {name: Decimal(addOnCount) } ) self.addOnCounts.update( {name: Decimal(addOnCount) } )
else:
self.addOnCounts.update( {name: None } )
if koCount: if koCount:
self.koCounts.update( {name : Decimal(koCount) } ) self.koCounts.update( {name : Decimal(koCount) } )
else:
self.koCounts.update( {name: None } )
#end def addPlayer #end def addPlayer
def incrementPlayerWinnings(self, name, additionnalWinnings): def incrementPlayerWinnings(self, name, additionnalWinnings):