Add printdata capability for Gametype info.
This commit is contained in:
parent
b1703a95ec
commit
f12bc7bfaa
|
@ -2169,7 +2169,7 @@ class Database:
|
||||||
dup = True
|
dup = True
|
||||||
return dup
|
return dup
|
||||||
|
|
||||||
def getGameTypeId(self, siteid, game):
|
def getGameTypeId(self, siteid, game, printdata = False):
|
||||||
c = self.get_cursor()
|
c = self.get_cursor()
|
||||||
#FIXME: Fixed for NL at the moment
|
#FIXME: Fixed for NL at the moment
|
||||||
c.execute(self.sql.query['getGametypeNL'], (siteid, game['type'], game['category'], game['limitType'], game['currency'],
|
c.execute(self.sql.query['getGametypeNL'], (siteid, game['type'], game['category'], game['limitType'], game['currency'],
|
||||||
|
@ -2181,14 +2181,22 @@ class Database:
|
||||||
hilo = "s"
|
hilo = "s"
|
||||||
elif game['category'] in ['razz','27_3draw','badugi', '27_1draw']:
|
elif game['category'] in ['razz','27_3draw','badugi', '27_1draw']:
|
||||||
hilo = "l"
|
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,
|
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['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
|
int(Decimal(game['bb'])*100), int(Decimal(game['bb'])*200)), printdata = printdata)
|
||||||
#FIXME: recognise currency
|
|
||||||
return tmp[0]
|
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 = self.get_cursor()
|
||||||
c.execute( self.sql.query['insertGameTypes'], row )
|
c.execute( self.sql.query['insertGameTypes'], row )
|
||||||
return [self.get_last_insert_id(c)]
|
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]
|
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
|
# Players, Gametypes, TourneyTypes are all shared functions that are needed for additional tables
|
||||||
# These functions are intended for prep insert eventually
|
# 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)
|
self.dbid_pids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
||||||
|
|
||||||
#Gametypes
|
#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:
|
if self.tourNo!=None:
|
||||||
self.tourneyTypeId = db.createTourneyType(self)
|
self.tourneyTypeId = db.createTourneyType(self)
|
||||||
|
|
|
@ -477,7 +477,7 @@ class Importer:
|
||||||
|
|
||||||
for hand in handlist:
|
for hand in handlist:
|
||||||
if hand is not None:
|
if hand is not None:
|
||||||
hand.prepInsert(self.database)
|
hand.prepInsert(self.database, printtest = self.settings['testData'])
|
||||||
try:
|
try:
|
||||||
hand.insert(self.database, printtest = self.settings['testData'])
|
hand.insert(self.database, printtest = self.settings['testData'])
|
||||||
except Exceptions.FpdbHandDuplicate:
|
except Exceptions.FpdbHandDuplicate:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user