diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index eb6f31a7..2a12ed11 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -2019,8 +2019,14 @@ class Database: if result != None and len(result)==1: tourneysPlayersIds.append(result[0]) else: - cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']), - (hand.tourneyId, playerId, None, None, None, None, None, None, None, None)) + if source=="HHC": + 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)) return tourneysPlayersIds #end def createOrUpdateTourneysPlayers diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index bceefa1e..9ad9f321 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -3664,8 +3664,8 @@ class Sql: """ self.query['insertTourneysPlayer'] = """INSERT INTO TourneysPlayers - (tourneyId, playerId, rank, winnings, winningsCurrency, rebuyCount, addOnCount, koCount, comment, commentTs) - VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + (tourneyId, playerId, rank, winnings, winningsCurrency, rebuyCount, addOnCount, koCount) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s) """ self.query['selectHandsPlayersWithWrongTTypeId'] = """SELECT id diff --git a/pyfpdb/TourneySummary.py b/pyfpdb/TourneySummary.py index 9d7c3009..f7632ea3 100644 --- a/pyfpdb/TourneySummary.py +++ b/pyfpdb/TourneySummary.py @@ -158,6 +158,7 @@ class TourneySummary(object): ("TOURNEYS PLAYERS IDS", self.tourneysPlayersIds), ("RANKS", self.ranks), ("WINNINGS", self.winnings), + ("WINNINGS CURRENCY", self.winningsCurrency), ("COUNT REBUYS", self.rebuyCounts), ("COUNT ADDONS", self.addOnCounts), ("NB OF KO", self.koCounts) @@ -191,9 +192,7 @@ class TourneySummary(object): for player in self.players: id=self.db.get_player_id(self.config, self.siteName, player) if not id: - self.db.insertPlayer(player, self.siteId) - id=self.db.get_last_insert_id(self.db.cursor) - + id=self.db.insertPlayer(player, self.siteId) self.playerIds.update({player:id}) #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 } ) if rebuyCount: self.rebuyCounts.update( {name: Decimal(rebuyCount) } ) + else: + self.rebuyCounts.update( {name: None } ) + if addOnCount: self.addOnCounts.update( {name: Decimal(addOnCount) } ) + else: + self.addOnCounts.update( {name: None } ) + if koCount: self.koCounts.update( {name : Decimal(koCount) } ) + else: + self.koCounts.update( {name: None } ) #end def addPlayer def incrementPlayerWinnings(self, name, additionnalWinnings):