Rename gameTypeId to gametypeId

Go through and change all references to gameTypeId to gametypeId to make it consistent.

The database field is named with the lowercase version, and MySQL is case sensitive.

This may have been causing minor issues in multiple areas when attempting to join on gametype.
This commit is contained in:
Worros 2010-12-10 22:31:12 +08:00
parent b543d08d80
commit 7dd8b9de16
7 changed files with 38 additions and 38 deletions

View File

@ -211,7 +211,7 @@ class HandInternal(DerivedStats):
def isDuplicate(self, session): def isDuplicate(self, session):
"""Checks if current hand already exists in db """Checks if current hand already exists in db
siteHandNo ans gameTypeId have to be setted siteHandNo ans gametypeId have to be setted
""" """
return session.query(HandInternal).filter_by( return session.query(HandInternal).filter_by(
siteHandNo=self.siteHandNo, gametypeId=self.gametypeId).count()!=0 siteHandNo=self.siteHandNo, gametypeId=self.gametypeId).count()!=0

View File

@ -1708,7 +1708,7 @@ class Database:
c.execute(q, ( c.execute(q, (
p['tableName'], p['tableName'],
p['gameTypeId'], p['gametypeId'],
p['siteHandNo'], p['siteHandNo'],
p['tourneyId'], p['tourneyId'],
p['startTime'], p['startTime'],

View File

@ -397,7 +397,7 @@ class GuiPositionalStats (threading.Thread):
query = query.replace("<selectgt.bigBlind>", bigblindselect) query = query.replace("<selectgt.bigBlind>", bigblindselect)
query = query.replace("<groupbygt.bigBlind>", "") query = query.replace("<groupbygt.bigBlind>", "")
query = query.replace("<hcgametypeId>", "-1") query = query.replace("<hcgametypeId>", "-1")
query = query.replace("<hgameTypeId>", "-1") query = query.replace("<hgametypeId>", "-1")
else: else:
if self.db.backend == self.MYSQL_INNODB: if self.db.backend == self.MYSQL_INNODB:
bigblindselect = """concat('$', trim(leading ' ' from bigblindselect = """concat('$', trim(leading ' ' from
@ -416,7 +416,7 @@ class GuiPositionalStats (threading.Thread):
query = query.replace("<selectgt.bigBlind>", bigblindselect) query = query.replace("<selectgt.bigBlind>", bigblindselect)
query = query.replace("<groupbygt.bigBlind>", ",gt.bigBlind") query = query.replace("<groupbygt.bigBlind>", ",gt.bigBlind")
query = query.replace("<hcgametypeId>", "hc.gametypeId") query = query.replace("<hcgametypeId>", "hc.gametypeId")
query = query.replace("<hgameTypeId>", "h.gameTypeId") query = query.replace("<hgametypeId>", "h.gametypeId")
# Filter on dates # Filter on dates
query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'") query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'")

View File

@ -652,18 +652,18 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
query = query.replace("<gtbigBlind_test>", bbtest) query = query.replace("<gtbigBlind_test>", bbtest)
if holecards: # re-use level variables for hole card query if holecards: # re-use level variables for hole card query
query = query.replace("<hgameTypeId>", "hp.startcards") query = query.replace("<hgametypeId>", "hp.startcards")
query = query.replace("<orderbyhgameTypeId>" query = query.replace("<orderbyhgametypeId>"
, ",case when floor((hp.startcards-1)/13) >= mod((hp.startcards-1),13) then hp.startcards + 0.1 " , ",case when floor((hp.startcards-1)/13) >= mod((hp.startcards-1),13) then hp.startcards + 0.1 "
+ " else 13*mod((hp.startcards-1),13) + floor((hp.startcards-1)/13) + 1 " + " else 13*mod((hp.startcards-1),13) + floor((hp.startcards-1)/13) + 1 "
+ " end desc ") + " end desc ")
else: else:
query = query.replace("<orderbyhgameTypeId>", "") query = query.replace("<orderbyhgametypeId>", "")
groupLevels = "show" not in str(limits) groupLevels = "show" not in str(limits)
if groupLevels: if groupLevels:
query = query.replace("<hgameTypeId>", "p.name") # need to use p.name for sqlite posn stats to work query = query.replace("<hgametypeId>", "p.name") # need to use p.name for sqlite posn stats to work
else: else:
query = query.replace("<hgameTypeId>", "h.gameTypeId") query = query.replace("<hgametypeId>", "h.gametypeId")
# process self.detailFilters (a list of tuples) # process self.detailFilters (a list of tuples)
flagtest = '' flagtest = ''

View File

@ -382,7 +382,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
#query = query.replace("<gtbigBlind_test>", bbtest) #query = query.replace("<gtbigBlind_test>", bbtest)
#query = query.replace("<orderbyhgameTypeId>", "") #query = query.replace("<orderbyhgametypeId>", "")
# process self.detailFilters (a list of tuples) # process self.detailFilters (a list of tuples)
flagtest = '' flagtest = ''

View File

@ -261,7 +261,7 @@ db: a connected Database object"""
if not db.isDuplicate(self.dbid_gt, hh['siteHandNo']): if not db.isDuplicate(self.dbid_gt, hh['siteHandNo']):
# Hands - Summary information of hand indexed by handId - gameinfo # Hands - Summary information of hand indexed by handId - gameinfo
hh['gameTypeId'] = self.dbid_gt hh['gametypeId'] = self.dbid_gt
# seats TINYINT NOT NULL, # seats TINYINT NOT NULL,
hh['seats'] = len(self.dbid_pids) hh['seats'] = len(self.dbid_pids)

View File

@ -1400,11 +1400,11 @@ class Sql:
self.query['addTourneyIndex'] = """CREATE UNIQUE INDEX siteTourneyNo ON Tourneys (siteTourneyNo, tourneyTypeId)""" self.query['addTourneyIndex'] = """CREATE UNIQUE INDEX siteTourneyNo ON Tourneys (siteTourneyNo, tourneyTypeId)"""
if db_server == 'mysql': if db_server == 'mysql':
self.query['addHandsIndex'] = """ALTER TABLE Hands ADD UNIQUE INDEX siteHandNo(siteHandNo, gameTypeId)""" self.query['addHandsIndex'] = """ALTER TABLE Hands ADD UNIQUE INDEX siteHandNo(siteHandNo, gametypeId)"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['addHandsIndex'] = """CREATE UNIQUE INDEX siteHandNo ON Hands (siteHandNo, gameTypeId)""" self.query['addHandsIndex'] = """CREATE UNIQUE INDEX siteHandNo ON Hands (siteHandNo, gametypeId)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['addHandsIndex'] = """CREATE UNIQUE INDEX siteHandNo ON Hands (siteHandNo, gameTypeId)""" self.query['addHandsIndex'] = """CREATE UNIQUE INDEX siteHandNo ON Hands (siteHandNo, gametypeId)"""
if db_server == 'mysql': if db_server == 'mysql':
self.query['addPlayersIndex'] = """ALTER TABLE Players ADD UNIQUE INDEX name(name, siteId)""" self.query['addPlayersIndex'] = """ALTER TABLE Players ADD UNIQUE INDEX name(name, siteId)"""
@ -2145,7 +2145,7 @@ class Sql:
if db_server == 'mysql': if db_server == 'mysql':
self.query['playerDetailedStats'] = """ self.query['playerDetailedStats'] = """
select <hgameTypeId> AS hgametypeid select <hgametypeId> AS hgametypeid
,<playerName> AS pname ,<playerName> AS pname
,gt.base ,gt.base
,gt.category ,gt.category
@ -2231,7 +2231,7 @@ class Sql:
,variance(hp.totalProfit/100.0) AS variance ,variance(hp.totalProfit/100.0) AS variance
from HandsPlayers hp from HandsPlayers hp
inner join Hands h on (h.id = hp.handId) inner join Hands h on (h.id = hp.handId)
inner join Gametypes gt on (gt.Id = h.gameTypeId) inner join Gametypes gt on (gt.Id = h.gametypeId)
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = gt.siteId)
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
@ -2242,7 +2242,7 @@ class Sql:
<flagtest> <flagtest>
<gtbigBlind_test> <gtbigBlind_test>
and date_format(h.startTime, '%Y-%m-%d %T') <datestest> and date_format(h.startTime, '%Y-%m-%d %T') <datestest>
group by hgameTypeId group by hgametypeId
,pname ,pname
,gt.base ,gt.base
,gt.category ,gt.category
@ -2259,14 +2259,14 @@ class Sql:
when 'S' then 'S' when 'S' then 'S'
else concat('Z', <position>) else concat('Z', <position>)
end end
<orderbyhgameTypeId> <orderbyhgametypeId>
,upper(gt.limitType) desc ,upper(gt.limitType) desc
,maxbigblind desc ,maxbigblind desc
,s.name ,s.name
""" """
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['playerDetailedStats'] = """ self.query['playerDetailedStats'] = """
select <hgameTypeId> AS hgametypeid select <hgametypeId> AS hgametypeid
,<playerName> AS pname ,<playerName> AS pname
,gt.base ,gt.base
,gt.category ,gt.category
@ -2352,7 +2352,7 @@ class Sql:
,variance(hp.totalProfit/100.0) AS variance ,variance(hp.totalProfit/100.0) AS variance
from HandsPlayers hp from HandsPlayers hp
inner join Hands h on (h.id = hp.handId) inner join Hands h on (h.id = hp.handId)
inner join Gametypes gt on (gt.Id = h.gameTypeId) inner join Gametypes gt on (gt.Id = h.gametypeId)
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = gt.siteId)
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
@ -2363,7 +2363,7 @@ class Sql:
<flagtest> <flagtest>
<gtbigBlind_test> <gtbigBlind_test>
and to_char(h.startTime, 'YYYY-MM-DD HH24:MI:SS') <datestest> and to_char(h.startTime, 'YYYY-MM-DD HH24:MI:SS') <datestest>
group by hgameTypeId group by hgametypeId
,pname ,pname
,gt.base ,gt.base
,gt.category ,gt.category
@ -2381,14 +2381,14 @@ class Sql:
when '0' then 'Y' when '0' then 'Y'
else 'Z'||<position> else 'Z'||<position>
end end
<orderbyhgameTypeId> <orderbyhgametypeId>
,upper(gt.limitType) desc ,upper(gt.limitType) desc
,maxbigblind desc ,maxbigblind desc
,s.name ,s.name
""" """
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['playerDetailedStats'] = """ self.query['playerDetailedStats'] = """
select <hgameTypeId> AS hgametypeid select <hgametypeId> AS hgametypeid
,<playerName> AS pname ,<playerName> AS pname
,gt.base ,gt.base
,gt.category AS category ,gt.category AS category
@ -2474,7 +2474,7 @@ class Sql:
,variance(hp.totalProfit/100.0) AS variance ,variance(hp.totalProfit/100.0) AS variance
from HandsPlayers hp from HandsPlayers hp
inner join Hands h on (h.id = hp.handId) inner join Hands h on (h.id = hp.handId)
inner join Gametypes gt on (gt.Id = h.gameTypeId) inner join Gametypes gt on (gt.Id = h.gametypeId)
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = gt.siteId)
inner join Players p on (p.Id = hp.playerId) inner join Players p on (p.Id = hp.playerId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
@ -2485,7 +2485,7 @@ class Sql:
<flagtest> <flagtest>
<gtbigBlind_test> <gtbigBlind_test>
and datetime(h.startTime) <datestest> and datetime(h.startTime) <datestest>
group by hgameTypeId group by hgametypeId
,hp.playerId ,hp.playerId
,gt.base ,gt.base
,gt.category ,gt.category
@ -2503,7 +2503,7 @@ class Sql:
when '0' then 'Y' when '0' then 'Y'
else 'Z'||<position> else 'Z'||<position>
end end
<orderbyhgameTypeId> <orderbyhgametypeId>
,upper(gt.limitType) desc ,upper(gt.limitType) desc
,max(gt.bigBlind) desc ,max(gt.bigBlind) desc
,s.name ,s.name
@ -2693,7 +2693,7 @@ class Sql:
,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats ,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats
from Gametypes gt from Gametypes gt
inner join Sites s on s.Id = gt.siteId inner join Sites s on s.Id = gt.siteId
inner join HudCache hc on hc.gameTypeId = gt.Id inner join HudCache hc on hc.gametypeId = gt.Id
where hc.playerId in <player_test> where hc.playerId in <player_test>
and <gtbigBlind_test> and <gtbigBlind_test>
and hc.activeSeats <seats_test> and hc.activeSeats <seats_test>
@ -2714,7 +2714,7 @@ class Sql:
else variance(hprof.profit/100.0) else variance(hprof.profit/100.0)
end as variance end as variance
from from
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit (select hp.handId, <hgametypeId> as gtId, hp.totalProfit as profit
from HandsPlayers hp from HandsPlayers hp
inner join Hands h ON h.id = hp.handId inner join Hands h ON h.id = hp.handId
where hp.playerId in <player_test> where hp.playerId in <player_test>
@ -2798,7 +2798,7 @@ class Sql:
,to_char(sum(activeSeats*HDs)/(sum(HDs)+0.0),'90D00') AS AvgSeats ,to_char(sum(activeSeats*HDs)/(sum(HDs)+0.0),'90D00') AS AvgSeats
from Gametypes gt from Gametypes gt
inner join Sites s on s.Id = gt.siteId inner join Sites s on s.Id = gt.siteId
inner join HudCache hc on hc.gameTypeId = gt.Id inner join HudCache hc on hc.gametypeId = gt.Id
where hc.playerId in <player_test> where hc.playerId in <player_test>
and <gtbigBlind_test> and <gtbigBlind_test>
and hc.activeSeats <seats_test> and hc.activeSeats <seats_test>
@ -2819,7 +2819,7 @@ class Sql:
else variance(hprof.profit/100.0) else variance(hprof.profit/100.0)
end as variance end as variance
from from
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit (select hp.handId, <hgametypeId> as gtId, hp.totalProfit as profit
from HandsPlayers hp from HandsPlayers hp
inner join Hands h ON (h.id = hp.handId) inner join Hands h ON (h.id = hp.handId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
@ -2921,7 +2921,7 @@ class Sql:
,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats ,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats
from Gametypes gt from Gametypes gt
inner join Sites s on s.Id = gt.siteId inner join Sites s on s.Id = gt.siteId
inner join HudCache hc on hc.gameTypeId = gt.Id inner join HudCache hc on hc.gametypeId = gt.Id
where hc.playerId in <player_test> where hc.playerId in <player_test>
and <gtbigBlind_test> and <gtbigBlind_test>
and hc.activeSeats <seats_test> and hc.activeSeats <seats_test>
@ -2951,7 +2951,7 @@ class Sql:
else variance(hprof.profit/100.0) else variance(hprof.profit/100.0)
end as variance end as variance
from from
(select hp.handId, <hgameTypeId> as gtId, hp.position (select hp.handId, <hgametypeId> as gtId, hp.position
, hp.totalProfit as profit , hp.totalProfit as profit
from HandsPlayers hp from HandsPlayers hp
inner join Hands h ON (h.id = hp.handId) inner join Hands h ON (h.id = hp.handId)
@ -3060,7 +3060,7 @@ class Sql:
,to_char(sum(activeSeats*HDs)/(sum(HDs)+0.0),'90D00') AS AvgSeats ,to_char(sum(activeSeats*HDs)/(sum(HDs)+0.0),'90D00') AS AvgSeats
from Gametypes gt from Gametypes gt
inner join Sites s on (s.Id = gt.siteId) inner join Sites s on (s.Id = gt.siteId)
inner join HudCache hc on (hc.gameTypeId = gt.Id) inner join HudCache hc on (hc.gametypeId = gt.Id)
where hc.playerId in <player_test> where hc.playerId in <player_test>
and <gtbigBlind_test> and <gtbigBlind_test>
and hc.activeSeats <seats_test> and hc.activeSeats <seats_test>
@ -3090,14 +3090,14 @@ class Sql:
else variance(hprof.profit/100.0) else variance(hprof.profit/100.0)
end as variance end as variance
from from
(select hp.handId, <hgameTypeId> as gtId, hp.position (select hp.handId, <hgametypeId> as gtId, hp.position
, hp.totalProfit as profit , hp.totalProfit as profit
from HandsPlayers hp from HandsPlayers hp
inner join Hands h ON (h.id = hp.handId) inner join Hands h ON (h.id = hp.handId)
where hp.playerId in <player_test> where hp.playerId in <player_test>
and hp.tourneysPlayersId IS NULL and hp.tourneysPlayersId IS NULL
and to_char(h.startTime, 'YYYY-MM-DD') <datestest> and to_char(h.startTime, 'YYYY-MM-DD') <datestest>
group by hp.handId, gameTypeId, hp.position, hp.totalProfit group by hp.handId, gametypeId, hp.position, hp.totalProfit
) hprof ) hprof
group by hprof.gtId, PlPosition group by hprof.gtId, PlPosition
) hprof2 ) hprof2
@ -3191,7 +3191,7 @@ class Sql:
SELECT UNIX_TIMESTAMP(h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit SELECT UNIX_TIMESTAMP(h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h on (h.id = hp.handId) INNER JOIN Hands h on (h.id = hp.handId)
INNER JOIN Gametypes gt on (gt.Id = h.gameTypeId) INNER JOIN Gametypes gt on (gt.Id = h.gametypeId)
INNER JOIN Sites s on (s.Id = gt.siteId) INNER JOIN Sites s on (s.Id = gt.siteId)
INNER JOIN Players p on (p.Id = hp.playerId) INNER JOIN Players p on (p.Id = hp.playerId)
WHERE hp.playerId in <player_test> WHERE hp.playerId in <player_test>
@ -3203,7 +3203,7 @@ class Sql:
SELECT EXTRACT(epoch from h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit SELECT EXTRACT(epoch from h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h on (h.id = hp.handId) INNER JOIN Hands h on (h.id = hp.handId)
INNER JOIN Gametypes gt on (gt.Id = h.gameTypeId) INNER JOIN Gametypes gt on (gt.Id = h.gametypeId)
INNER JOIN Sites s on (s.Id = gt.siteId) INNER JOIN Sites s on (s.Id = gt.siteId)
INNER JOIN Players p on (p.Id = hp.playerId) INNER JOIN Players p on (p.Id = hp.playerId)
WHERE hp.playerId in <player_test> WHERE hp.playerId in <player_test>
@ -3215,7 +3215,7 @@ class Sql:
SELECT STRFTIME('<ampersand_s>', h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit SELECT STRFTIME('<ampersand_s>', h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h on (h.id = hp.handId) INNER JOIN Hands h on (h.id = hp.handId)
INNER JOIN Gametypes gt on (gt.Id = h.gameTypeId) INNER JOIN Gametypes gt on (gt.Id = h.gametypeId)
INNER JOIN Sites s on (s.Id = gt.siteId) INNER JOIN Sites s on (s.Id = gt.siteId)
INNER JOIN Players p on (p.Id = hp.playerId) INNER JOIN Players p on (p.Id = hp.playerId)
WHERE hp.playerId in <player_test> WHERE hp.playerId in <player_test>