it now stores entries, prizepool and endTime into TT
This commit is contained in:
parent
e815cc38db
commit
5b64ad771a
|
@ -1932,7 +1932,7 @@ class Database:
|
|||
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
# end def send_finish_msg():
|
||||
|
||||
def createOrUpdateTourneyType(self, hand):
|
||||
def createOrUpdateTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects
|
||||
tourneyTypeId = 1
|
||||
|
||||
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
|
||||
|
@ -1978,7 +1978,7 @@ class Database:
|
|||
return tourneyTypeId
|
||||
#end def createOrUpdateTourneyType
|
||||
|
||||
def createOrUpdateTourney(self, hand):
|
||||
def createOrUpdateTourney(self, hand, source):#note: this method is used on Hand and TourneySummary objects
|
||||
cursor = self.get_cursor()
|
||||
cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.siteId, hand.tourNo))
|
||||
|
@ -1987,21 +1987,29 @@ class Database:
|
|||
if result != None and len(result)==1:
|
||||
tourneyId = result[0]
|
||||
else:
|
||||
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||
if source=="HHC":
|
||||
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.tourneyTypeId, hand.tourNo, None, None,
|
||||
hand.startTime, None, None, None,
|
||||
None, None))
|
||||
hand.startTime, None, None, None, None, None))
|
||||
elif source=="TS":
|
||||
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.tourneyTypeId, hand.tourNo, hand.entries, hand.prizepool,
|
||||
hand.startTime, hand.endTime, hand.tourneyName, hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount))
|
||||
else:
|
||||
raise FpdbParseError("invalid source in Database.createOrUpdateTourney")
|
||||
tourneyId = self.get_last_insert_id(cursor)
|
||||
return tourneyId
|
||||
#end def createOrUpdateTourney
|
||||
|
||||
def createOrUpdateTourneysPlayers(self, hand, source=None):
|
||||
def createOrUpdateTourneysPlayers(self, hand, source):#note: this method is used on Hand and TourneySummary objects
|
||||
tourneysPlayersIds=[]
|
||||
for player in hand.players:
|
||||
if source=="TourneySummary": #TODO remove this horrible hack
|
||||
if source=="TS": #TODO remove this horrible hack
|
||||
playerId = hand.dbid_pids[player]
|
||||
else:
|
||||
elif source=="HHC":
|
||||
playerId = hand.dbid_pids[player[1]]
|
||||
else:
|
||||
raise FpdbParseError("invalid source in Database.createOrUpdateTourneysPlayers")
|
||||
|
||||
cursor = self.get_cursor()
|
||||
cursor.execute (self.sql.query['getTourneysPlayersId'].replace('%s', self.sql.query['placeholder']),
|
||||
|
|
|
@ -229,9 +229,9 @@ dealt whether they were seen in a 'dealt to' line
|
|||
if self.tourNo!=None:
|
||||
self.tourneyTypeId = db.createOrUpdateTourneyType(self)
|
||||
db.commit()
|
||||
self.tourneyId = db.createOrUpdateTourney(self)
|
||||
self.tourneyId = db.createOrUpdateTourney(self, "HHC")
|
||||
db.commit()
|
||||
self.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self)
|
||||
self.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self, "HHC")
|
||||
db.commit()
|
||||
#end def prepInsert
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ class TourneySummary(object):
|
|||
self.isMatrix = False
|
||||
self.isShootout = False
|
||||
self.matrixMatchId = None # For Matrix tourneys : 1-4 => match tables (traditionnal), 0 => Positional winnings info
|
||||
self.matrixIdProcessed = None
|
||||
self.subTourneyBuyin = None
|
||||
self.subTourneyFee = None
|
||||
self.rebuyChips = 0
|
||||
|
@ -133,6 +134,7 @@ class TourneySummary(object):
|
|||
("ADDON", self.isAddOn),
|
||||
("KO", self.isKO),
|
||||
("MATRIX", self.isMatrix),
|
||||
("MATRIX ID PROCESSED", self.matrixIdProcessed),
|
||||
("SHOOTOUT", self.isShootout),
|
||||
("MATRIX MATCH ID", self.matrixMatchId),
|
||||
("SUB TOURNEY BUY IN", self.subTourneyBuyin),
|
||||
|
@ -202,9 +204,9 @@ class TourneySummary(object):
|
|||
#print "TS.self before starting insert",self
|
||||
self.tourneyTypeId = self.db.createOrUpdateTourneyType(self)
|
||||
self.db.commit()
|
||||
self.tourneyId = self.db.createOrUpdateTourney(self)
|
||||
self.tourneyId = self.db.createOrUpdateTourney(self, "TS")
|
||||
self.db.commit()
|
||||
self.tourneysPlayersIds = self.db.createOrUpdateTourneysPlayers(self, "TourneySummary")
|
||||
self.tourneysPlayersIds = self.db.createOrUpdateTourneysPlayers(self, "TS")
|
||||
self.db.commit()
|
||||
|
||||
logging.debug("Tourney Insert/Update done")
|
||||
|
|
|
@ -741,7 +741,7 @@ class fpdb:
|
|||
|
||||
def import_imap_summaries(self, widget, data=None):
|
||||
result=ImapSummaries.run(self.config, self.db)
|
||||
print "import imap summaries result:", result
|
||||
#print "import imap summaries result:", result
|
||||
#end def import_imap_summaries
|
||||
|
||||
def load_profile(self, create_db = False):
|
||||
|
|
Loading…
Reference in New Issue
Block a user