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:
parent
b543d08d80
commit
7dd8b9de16
|
@ -211,7 +211,7 @@ class HandInternal(DerivedStats):
|
|||
def isDuplicate(self, session):
|
||||
"""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(
|
||||
siteHandNo=self.siteHandNo, gametypeId=self.gametypeId).count()!=0
|
||||
|
|
|
@ -1708,7 +1708,7 @@ class Database:
|
|||
|
||||
c.execute(q, (
|
||||
p['tableName'],
|
||||
p['gameTypeId'],
|
||||
p['gametypeId'],
|
||||
p['siteHandNo'],
|
||||
p['tourneyId'],
|
||||
p['startTime'],
|
||||
|
|
|
@ -397,7 +397,7 @@ class GuiPositionalStats (threading.Thread):
|
|||
query = query.replace("<selectgt.bigBlind>", bigblindselect)
|
||||
query = query.replace("<groupbygt.bigBlind>", "")
|
||||
query = query.replace("<hcgametypeId>", "-1")
|
||||
query = query.replace("<hgameTypeId>", "-1")
|
||||
query = query.replace("<hgametypeId>", "-1")
|
||||
else:
|
||||
if self.db.backend == self.MYSQL_INNODB:
|
||||
bigblindselect = """concat('$', trim(leading ' ' from
|
||||
|
@ -416,7 +416,7 @@ class GuiPositionalStats (threading.Thread):
|
|||
query = query.replace("<selectgt.bigBlind>", bigblindselect)
|
||||
query = query.replace("<groupbygt.bigBlind>", ",gt.bigBlind")
|
||||
query = query.replace("<hcgametypeId>", "hc.gametypeId")
|
||||
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||
query = query.replace("<hgametypeId>", "h.gametypeId")
|
||||
|
||||
# Filter on dates
|
||||
query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'")
|
||||
|
|
|
@ -652,18 +652,18 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
|||
query = query.replace("<gtbigBlind_test>", bbtest)
|
||||
|
||||
if holecards: # re-use level variables for hole card query
|
||||
query = query.replace("<hgameTypeId>", "hp.startcards")
|
||||
query = query.replace("<orderbyhgameTypeId>"
|
||||
query = query.replace("<hgametypeId>", "hp.startcards")
|
||||
query = query.replace("<orderbyhgametypeId>"
|
||||
, ",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 "
|
||||
+ " end desc ")
|
||||
else:
|
||||
query = query.replace("<orderbyhgameTypeId>", "")
|
||||
query = query.replace("<orderbyhgametypeId>", "")
|
||||
groupLevels = "show" not in str(limits)
|
||||
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:
|
||||
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||
query = query.replace("<hgametypeId>", "h.gametypeId")
|
||||
|
||||
# process self.detailFilters (a list of tuples)
|
||||
flagtest = ''
|
||||
|
|
|
@ -382,7 +382,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
|||
|
||||
#query = query.replace("<gtbigBlind_test>", bbtest)
|
||||
|
||||
#query = query.replace("<orderbyhgameTypeId>", "")
|
||||
#query = query.replace("<orderbyhgametypeId>", "")
|
||||
|
||||
# process self.detailFilters (a list of tuples)
|
||||
flagtest = ''
|
||||
|
|
|
@ -261,7 +261,7 @@ db: a connected Database object"""
|
|||
|
||||
if not db.isDuplicate(self.dbid_gt, hh['siteHandNo']):
|
||||
# Hands - Summary information of hand indexed by handId - gameinfo
|
||||
hh['gameTypeId'] = self.dbid_gt
|
||||
hh['gametypeId'] = self.dbid_gt
|
||||
# seats TINYINT NOT NULL,
|
||||
hh['seats'] = len(self.dbid_pids)
|
||||
|
||||
|
|
|
@ -1400,11 +1400,11 @@ class Sql:
|
|||
self.query['addTourneyIndex'] = """CREATE UNIQUE INDEX siteTourneyNo ON Tourneys (siteTourneyNo, tourneyTypeId)"""
|
||||
|
||||
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':
|
||||
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':
|
||||
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':
|
||||
self.query['addPlayersIndex'] = """ALTER TABLE Players ADD UNIQUE INDEX name(name, siteId)"""
|
||||
|
@ -2145,7 +2145,7 @@ class Sql:
|
|||
|
||||
if db_server == 'mysql':
|
||||
self.query['playerDetailedStats'] = """
|
||||
select <hgameTypeId> AS hgametypeid
|
||||
select <hgametypeId> AS hgametypeid
|
||||
,<playerName> AS pname
|
||||
,gt.base
|
||||
,gt.category
|
||||
|
@ -2231,7 +2231,7 @@ class Sql:
|
|||
,variance(hp.totalProfit/100.0) AS variance
|
||||
from HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
where hp.playerId in <player_test>
|
||||
|
@ -2242,7 +2242,7 @@ class Sql:
|
|||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
and date_format(h.startTime, '%Y-%m-%d %T') <datestest>
|
||||
group by hgameTypeId
|
||||
group by hgametypeId
|
||||
,pname
|
||||
,gt.base
|
||||
,gt.category
|
||||
|
@ -2259,14 +2259,14 @@ class Sql:
|
|||
when 'S' then 'S'
|
||||
else concat('Z', <position>)
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
<orderbyhgametypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,maxbigblind desc
|
||||
,s.name
|
||||
"""
|
||||
elif db_server == 'postgresql':
|
||||
self.query['playerDetailedStats'] = """
|
||||
select <hgameTypeId> AS hgametypeid
|
||||
select <hgametypeId> AS hgametypeid
|
||||
,<playerName> AS pname
|
||||
,gt.base
|
||||
,gt.category
|
||||
|
@ -2352,7 +2352,7 @@ class Sql:
|
|||
,variance(hp.totalProfit/100.0) AS variance
|
||||
from HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
where hp.playerId in <player_test>
|
||||
|
@ -2363,7 +2363,7 @@ class Sql:
|
|||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
and to_char(h.startTime, 'YYYY-MM-DD HH24:MI:SS') <datestest>
|
||||
group by hgameTypeId
|
||||
group by hgametypeId
|
||||
,pname
|
||||
,gt.base
|
||||
,gt.category
|
||||
|
@ -2381,14 +2381,14 @@ class Sql:
|
|||
when '0' then 'Y'
|
||||
else 'Z'||<position>
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
<orderbyhgametypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,maxbigblind desc
|
||||
,s.name
|
||||
"""
|
||||
elif db_server == 'sqlite':
|
||||
self.query['playerDetailedStats'] = """
|
||||
select <hgameTypeId> AS hgametypeid
|
||||
select <hgametypeId> AS hgametypeid
|
||||
,<playerName> AS pname
|
||||
,gt.base
|
||||
,gt.category AS category
|
||||
|
@ -2474,7 +2474,7 @@ class Sql:
|
|||
,variance(hp.totalProfit/100.0) AS variance
|
||||
from HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
where hp.playerId in <player_test>
|
||||
|
@ -2485,7 +2485,7 @@ class Sql:
|
|||
<flagtest>
|
||||
<gtbigBlind_test>
|
||||
and datetime(h.startTime) <datestest>
|
||||
group by hgameTypeId
|
||||
group by hgametypeId
|
||||
,hp.playerId
|
||||
,gt.base
|
||||
,gt.category
|
||||
|
@ -2503,7 +2503,7 @@ class Sql:
|
|||
when '0' then 'Y'
|
||||
else 'Z'||<position>
|
||||
end
|
||||
<orderbyhgameTypeId>
|
||||
<orderbyhgametypeId>
|
||||
,upper(gt.limitType) desc
|
||||
,max(gt.bigBlind) desc
|
||||
,s.name
|
||||
|
@ -2693,7 +2693,7 @@ class Sql:
|
|||
,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats
|
||||
from Gametypes gt
|
||||
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>
|
||||
and <gtbigBlind_test>
|
||||
and hc.activeSeats <seats_test>
|
||||
|
@ -2714,7 +2714,7 @@ class Sql:
|
|||
else variance(hprof.profit/100.0)
|
||||
end as variance
|
||||
from
|
||||
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit
|
||||
(select hp.handId, <hgametypeId> as gtId, hp.totalProfit as profit
|
||||
from HandsPlayers hp
|
||||
inner join Hands h ON h.id = hp.handId
|
||||
where hp.playerId in <player_test>
|
||||
|
@ -2798,7 +2798,7 @@ class Sql:
|
|||
,to_char(sum(activeSeats*HDs)/(sum(HDs)+0.0),'90D00') AS AvgSeats
|
||||
from Gametypes gt
|
||||
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>
|
||||
and <gtbigBlind_test>
|
||||
and hc.activeSeats <seats_test>
|
||||
|
@ -2819,7 +2819,7 @@ class Sql:
|
|||
else variance(hprof.profit/100.0)
|
||||
end as variance
|
||||
from
|
||||
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit
|
||||
(select hp.handId, <hgametypeId> as gtId, hp.totalProfit as profit
|
||||
from HandsPlayers hp
|
||||
inner join Hands h ON (h.id = hp.handId)
|
||||
where hp.playerId in <player_test>
|
||||
|
@ -2921,7 +2921,7 @@ class Sql:
|
|||
,format( sum(activeSeats*HDs)/(sum(HDs)+0.0), 2) AS AvgSeats
|
||||
from Gametypes gt
|
||||
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>
|
||||
and <gtbigBlind_test>
|
||||
and hc.activeSeats <seats_test>
|
||||
|
@ -2951,7 +2951,7 @@ class Sql:
|
|||
else variance(hprof.profit/100.0)
|
||||
end as variance
|
||||
from
|
||||
(select hp.handId, <hgameTypeId> as gtId, hp.position
|
||||
(select hp.handId, <hgametypeId> as gtId, hp.position
|
||||
, hp.totalProfit as profit
|
||||
from HandsPlayers hp
|
||||
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
|
||||
from Gametypes gt
|
||||
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>
|
||||
and <gtbigBlind_test>
|
||||
and hc.activeSeats <seats_test>
|
||||
|
@ -3090,14 +3090,14 @@ class Sql:
|
|||
else variance(hprof.profit/100.0)
|
||||
end as variance
|
||||
from
|
||||
(select hp.handId, <hgameTypeId> as gtId, hp.position
|
||||
(select hp.handId, <hgametypeId> as gtId, hp.position
|
||||
, hp.totalProfit as profit
|
||||
from HandsPlayers hp
|
||||
inner join Hands h ON (h.id = hp.handId)
|
||||
where hp.playerId in <player_test>
|
||||
and hp.tourneysPlayersId IS NULL
|
||||
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
|
||||
group by hprof.gtId, PlPosition
|
||||
) hprof2
|
||||
|
@ -3191,7 +3191,7 @@ class Sql:
|
|||
SELECT UNIX_TIMESTAMP(h.startTime) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit
|
||||
FROM HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
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
|
||||
FROM HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
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
|
||||
FROM HandsPlayers hp
|
||||
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 Players p on (p.Id = hp.playerId)
|
||||
WHERE hp.playerId in <player_test>
|
||||
|
|
Loading…
Reference in New Issue
Block a user