Database: Reformat a some tournament results update code
Reformat to make life easier when debugging
This commit is contained in:
parent
045cd1e9a6
commit
e0124d2d11
|
@ -2359,8 +2359,9 @@ class Database:
|
|||
|
||||
def createOrUpdateTourney(self, hand, source):#note: this method is used on Hand and TourneySummary objects
|
||||
cursor = self.get_cursor()
|
||||
cursor.execute (self.sql.query['getTourneyByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.siteId, hand.tourNo))
|
||||
q = self.sql.query['getTourneyByTourneyNo'].replace('%s', self.sql.query['placeholder'])
|
||||
cursor.execute(q, (hand.siteId, hand.tourNo))
|
||||
|
||||
columnNames=[desc[0] for desc in cursor.description]
|
||||
result=cursor.fetchone()
|
||||
|
||||
|
@ -2385,9 +2386,12 @@ class Database:
|
|||
# if (resultDict[ev] < hand.startTime):
|
||||
# hand.startTime=resultDict[ev]
|
||||
if updateDb:
|
||||
cursor.execute (self.sql.query['updateTourney'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.entries, hand.prizepool, hand.startTime, hand.endTime, hand.tourneyName,
|
||||
hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount, hand.comment, hand.commentTs, tourneyId))
|
||||
q = self.sql.query['updateTourney'].replace('%s', self.sql.query['placeholder'])
|
||||
row = (hand.entries, hand.prizepool, hand.startTime, hand.endTime, hand.tourneyName,
|
||||
hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount, hand.comment,
|
||||
hand.commentTs, tourneyId
|
||||
)
|
||||
cursor.execute(q, row)
|
||||
else:
|
||||
if source=="HHC":
|
||||
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
|
||||
|
@ -2436,9 +2440,19 @@ class Database:
|
|||
elif getattr(hand, handAttribute)[player]!=None and resultDict[ev]==None:#object has this value but DB doesnt, so update DB
|
||||
updateDb=True
|
||||
if updateDb:
|
||||
cursor.execute (self.sql.query['updateTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
|
||||
(hand.ranks[player], hand.winnings[player], hand.winningsCurrency[player],
|
||||
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player], tourneysPlayersIds[player[1]]))
|
||||
q = self.sql.query['updateTourneysPlayer'].replace('%s', self.sql.query['placeholder'])
|
||||
inputs = (hand.ranks[player],
|
||||
hand.winnings[player],
|
||||
hand.winningsCurrency[player],
|
||||
hand.rebuyCounts[player],
|
||||
hand.addOnCounts[player],
|
||||
hand.koCounts[player],
|
||||
tourneysPlayersIds[player[1]]
|
||||
)
|
||||
#print q
|
||||
#pp = pprint.PrettyPrinter(indent=4)
|
||||
#pp.pprint(inputs)
|
||||
cursor.execute(q, inputs)
|
||||
else:
|
||||
if source=="HHC":
|
||||
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
|
||||
|
|
Loading…
Reference in New Issue
Block a user