Add printdata capability for Gametype info.
This commit is contained in:
parent
b1703a95ec
commit
f12bc7bfaa
|
@ -2169,7 +2169,7 @@ class Database:
|
|||
dup = True
|
||||
return dup
|
||||
|
||||
def getGameTypeId(self, siteid, game):
|
||||
def getGameTypeId(self, siteid, game, printdata = False):
|
||||
c = self.get_cursor()
|
||||
#FIXME: Fixed for NL at the moment
|
||||
c.execute(self.sql.query['getGametypeNL'], (siteid, game['type'], game['category'], game['limitType'], game['currency'],
|
||||
|
@ -2181,14 +2181,22 @@ class Database:
|
|||
hilo = "s"
|
||||
elif game['category'] in ['razz','27_3draw','badugi', '27_1draw']:
|
||||
hilo = "l"
|
||||
#FIXME: recognise currency
|
||||
#TODO: this wont work for non-standard structures
|
||||
tmp = self.insertGameTypes( (siteid, game['currency'], game['type'], game['base'], game['category'], game['limitType'], hilo,
|
||||
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100),
|
||||
int(Decimal(game['bb'])*100), int(Decimal(game['bb'])*200)) ) #TODO: this wont work for non-standard structures
|
||||
#FIXME: recognise currency
|
||||
int(Decimal(game['bb'])*100), int(Decimal(game['bb'])*200)), printdata = printdata)
|
||||
return tmp[0]
|
||||
|
||||
|
||||
def insertGameTypes(self, row):
|
||||
def insertGameTypes(self, row, printdata = False):
|
||||
if printdata:
|
||||
print _("######## Gametype ##########")
|
||||
import pprint
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
pp.pprint(row)
|
||||
print _("###### End Gametype ########")
|
||||
|
||||
c = self.get_cursor()
|
||||
c.execute( self.sql.query['insertGameTypes'], row )
|
||||
return [self.get_last_insert_id(c)]
|
||||
|
|
|
@ -226,7 +226,7 @@ dealt whether they were seen in a 'dealt to' line
|
|||
|
||||
self.holecards[street][player] = [open, closed]
|
||||
|
||||
def prepInsert(self, db):
|
||||
def prepInsert(self, db, printtest = False):
|
||||
#####
|
||||
# Players, Gametypes, TourneyTypes are all shared functions that are needed for additional tables
|
||||
# These functions are intended for prep insert eventually
|
||||
|
@ -235,7 +235,7 @@ dealt whether they were seen in a 'dealt to' line
|
|||
self.dbid_pids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
||||
|
||||
#Gametypes
|
||||
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
||||
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype, printdata = printtest)
|
||||
|
||||
if self.tourNo!=None:
|
||||
self.tourneyTypeId = db.createTourneyType(self)
|
||||
|
|
|
@ -477,7 +477,7 @@ class Importer:
|
|||
|
||||
for hand in handlist:
|
||||
if hand is not None:
|
||||
hand.prepInsert(self.database)
|
||||
hand.prepInsert(self.database, printtest = self.settings['testData'])
|
||||
try:
|
||||
hand.insert(self.database, printtest = self.settings['testData'])
|
||||
except Exceptions.FpdbHandDuplicate:
|
||||
|
|
Loading…
Reference in New Issue
Block a user