From 9ad275e11c4bbf6d9c97cb6a3fa75ffa836a99de Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 2 Aug 2010 13:53:50 +0200 Subject: [PATCH] recognise and store knockout and bounty --- pyfpdb/Database.py | 6 +++--- pyfpdb/Hand.py | 2 ++ pyfpdb/PokerStarsToFpdb.py | 3 ++- pyfpdb/SQL.py | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 500dfb0a..e810d28a 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1990,7 +1990,7 @@ class Database: #print "the query:",self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']) cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']), (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.isKO, - hand.isRebuy, hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix) + hand.isRebuy, hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix) #TODO: add koamount ) result=cursor.fetchone() #print "result of fetching TT by details:",result @@ -1999,8 +1999,8 @@ class Database: tourneyTypeId = result[0] except TypeError: #this means we need to create a new entry cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']), - (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.buyInChips, - hand.isKO, hand.isRebuy, + (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], + hand.buyInChips, hand.isKO, hand.koBounty, hand.isRebuy, hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix, hand.added, hand.addedCurrency) ) tourneyTypeId = self.get_last_insert_id(cursor) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index a1a6c5d8..e4965dab 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -83,6 +83,7 @@ class Hand(object): self.isRebuy = False self.isAddOn = False self.isKO = False + self.koBounty = None self.isMatrix = False self.isShootout = False self.added = None @@ -168,6 +169,7 @@ class Hand(object): ("IS REBUY", self.isRebuy), ("IS ADDON", self.isAddOn), ("IS KO", self.isKO), + ("KO BOUNTY", self.koBounty), ("IS MATRIX", self.isMatrix), ("IS SHOOTOUT", self.isShootout), ("TOURNEY COMMENT", self.tourneyComment), diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index cdeeb74c..28dbd219 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -257,7 +257,8 @@ class PokerStars(HandHistoryConverter): hand.fee = int(100*Decimal(info['BOUNTY'][1:])) else: hand.fee = int(100*Decimal(info['BIRAKE'][1:])) - # TODO: Bounty is in key 'BOUNTY' + hand.isKO = True + hand.koBounty = int(100*Decimal(info['BOUNTY'][1:])) else: hand.buyin = int(Decimal(info[key][0:-3])) hand.fee = 0 diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index fcebc5c9..8d9e5f1b 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -3786,9 +3786,9 @@ class Sql: """ self.query['insertTourneyType'] = """INSERT INTO TourneyTypes - (siteId, currency, buyin, fee, category, limitType, buyInChips, knockout, rebuy, + (siteId, currency, buyin, fee, category, limitType, buyInChips, knockout, koBounty, rebuy, addOn ,speed, shootout, matrix, added, addedCurrency) - VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """ self.query['getTourneyByTourneyNo'] = """SELECT t.*