renamed tourneyplayers to tourneysplayers in a few places

This commit is contained in:
steffen123 2010-06-21 17:12:20 +02:00
parent e6fd3afbba
commit e46b0b7a0f
5 changed files with 16 additions and 14 deletions

View File

@ -185,7 +185,7 @@ class HandInternal(DerivedStats):
# fetch and update tourney players # fetch and update tourney players
for hp in self.handPlayers: for hp in self.handPlayers:
tp = TourneyPlayer.get_or_create(session, tour.id, hp.playerId) tp = TourneysPlayer.get_or_create(session, tour.id, hp.playerId)
# FIXME: other TourneysPlayers should be added here # FIXME: other TourneysPlayers should be added here
session.flush() session.flush()
@ -387,7 +387,7 @@ class TourneyType(MappedBase):
return get_or_create(cls, session, **kwargs)[0] return get_or_create(cls, session, **kwargs)[0]
class TourneyPlayer(MappedBase): class TourneysPlayer(MappedBase):
"""Class reflecting TourneysPlayers db table""" """Class reflecting TourneysPlayers db table"""
@classmethod @classmethod
@ -439,7 +439,7 @@ mapper (Gametype, gametypes_table, properties={
}) })
mapper (Player, players_table, properties={ mapper (Player, players_table, properties={
'playerHands': relation(HandPlayer, backref='player'), 'playerHands': relation(HandPlayer, backref='player'),
'playerTourney': relation(TourneyPlayer, backref='player'), 'playerTourney': relation(TourneysPlayer, backref='player'),
}) })
mapper (Site, sites_table, properties={ mapper (Site, sites_table, properties={
'gametypes': relation(Gametype, backref = 'site'), 'gametypes': relation(Gametype, backref = 'site'),
@ -457,7 +457,7 @@ mapper (Tourney, tourneys_table)
mapper (TourneyType, tourney_types_table, properties={ mapper (TourneyType, tourney_types_table, properties={
'tourneys': relation(Tourney, backref='type'), 'tourneys': relation(Tourney, backref='type'),
}) })
mapper (TourneyPlayer, tourneys_players_table) mapper (TourneysPlayer, tourneys_players_table)
class LambdaKeyDict(defaultdict): class LambdaKeyDict(defaultdict):
"""Operates like defaultdict but passes key argument to the factory function""" """Operates like defaultdict but passes key argument to the factory function"""

View File

@ -66,7 +66,7 @@ class Fulltilt(HandHistoryConverter):
''', re.VERBOSE) ''', re.VERBOSE)
re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE) re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE)
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE) re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE)
re_TourneyPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE) re_TourneysPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE)
re_Board = re.compile(r"\[(?P<CARDS>.+)\]") re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
#static regex for tourney purpose #static regex for tourney purpose
@ -99,7 +99,7 @@ class Fulltilt(HandHistoryConverter):
re_TourneyCountKO = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?") re_TourneyCountKO = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$") re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
re_TourneyPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE) re_TourneysPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place") re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place")
#TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo) #TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo)
@ -264,7 +264,7 @@ class Fulltilt(HandHistoryConverter):
if hand.gametype['type'] == "ring" : if hand.gametype['type'] == "ring" :
m = self.re_PlayerInfo.finditer(pre) m = self.re_PlayerInfo.finditer(pre)
else: #if hand.gametype['type'] == "tour" else: #if hand.gametype['type'] == "tour"
m = self.re_TourneyPlayerInfo.finditer(pre) m = self.re_TourneysPlayerInfo.finditer(pre)
for a in m: for a in m:
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH')) hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
@ -642,7 +642,7 @@ class Fulltilt(HandHistoryConverter):
def getPlayersPositionsAndWinnings(self, tourney): def getPlayersPositionsAndWinnings(self, tourney):
playersText = tourney.summaryText[1] playersText = tourney.summaryText[1]
#print "Examine : '%s'" %(playersText) #print "Examine : '%s'" %(playersText)
m = self.re_TourneyPlayersSummary.finditer(playersText) m = self.re_TourneysPlayersSummary.finditer(playersText)
for a in m: for a in m:
if a.group('PNAME') is not None and a.group('RANK') is not None: if a.group('PNAME') is not None and a.group('RANK') is not None:

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2009 Eric Blade, and the FPDB team. # Copyright (c) 2009 Eric Blade, and the FPDB team.
@ -51,7 +52,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
self.nextPool = False self.nextPool = False
self.TourneyPool = None self.TourneyPool = None
self.nextPlayers = False self.nextPlayers = False
self.TourneyPlayers = None self.TourneysPlayers = None
self.nextAllowRebuys = False self.nextAllowRebuys = False
self.TourneyRebuys = None self.TourneyRebuys = None
self.parseResultsA = False self.parseResultsA = False
@ -134,7 +135,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
if not self.nextPlayers and x == "Player Count:": if not self.nextPlayers and x == "Player Count:":
self.nextPlayers = True self.nextPlayers = True
elif self.nextPlayers: elif self.nextPlayers:
self.TourneyPlayers = x self.TourneysPlayers = x
self.nextPlayers = False self.nextPlayers = False
if not self.nextAllowRebuys and x == "Rebuys possible?:": if not self.nextAllowRebuys and x == "Rebuys possible?:":
@ -179,7 +180,7 @@ class EverleafSummary:
print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId
print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime
print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType
print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneyPlayers, "pool=", self.parser.TourneyPool print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneysPlayers, "pool=", self.parser.TourneyPool
print "results=", self.parser.Results print "results=", self.parser.Results

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""TourneyTracker.py """TourneyTracker.py
Based on HUD_main .. who knows if we want to actually use this or not Based on HUD_main .. who knows if we want to actually use this or not
""" """
@ -86,7 +87,7 @@ class Tournament:
self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee
self.rebuys = (summary.parser.TourneyRebuys == "yes") self.rebuys = (summary.parser.TourneyRebuys == "yes")
self.prizepool = summary.parser.TourneyPool self.prizepool = summary.parser.TourneyPool
self.numplayers = summary.parser.TourneyPlayers self.numplayers = summary.parser.TourneysPlayers
self.openwindow() # let's start by getting any info we need.. meh self.openwindow() # let's start by getting any info we need.. meh

View File

@ -166,14 +166,14 @@ class Tourney(object):
logging.debug("Tourney Type ID = %d" % dbTourneyTypeId) logging.debug("Tourney Type ID = %d" % dbTourneyTypeId)
dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId) dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId)
logging.debug("Tourney ID = %d" % dbTourneyId) logging.debug("Tourney ID = %d" % dbTourneyId)
dbTourneysPlayersIds = db.tStoreTourneyPlayers(self, dbTourneyId) dbTourneysPlayersIds = db.tStoreTourneysPlayers(self, dbTourneyId)
logging.debug("TourneysPlayersId = %s" % dbTourneysPlayersIds) logging.debug("TourneysPlayersId = %s" % dbTourneysPlayersIds)
db.tUpdateTourneysHandsPlayers(self, dbTourneysPlayersIds, dbTourneyTypeId) db.tUpdateTourneysHandsPlayers(self, dbTourneysPlayersIds, dbTourneyTypeId)
logging.debug("tUpdateTourneysHandsPlayers done") logging.debug("tUpdateTourneysHandsPlayers done")
logging.debug("Tourney Insert done") logging.debug("Tourney Insert done")
# TO DO : Return what has been done (tourney created, updated, nothing) # TO DO : Return what has been done (tourney created, updated, nothing)
# ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneyPlayers and handsplayers) # ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneysPlayers and handsPlayers)
# if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information # if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information
stored = 0 stored = 0
duplicates = 0 duplicates = 0