Merge branch 'master' of git://git.assembla.com/fpdb-sql

This commit is contained in:
Worros 2009-05-17 12:09:55 +08:00
commit 2c01a1f911
7 changed files with 595 additions and 98 deletions

View File

@ -48,7 +48,7 @@ class Filters(threading.Thread):
# text used on screen stored here so that it can be configured
self.filterText = {'limitsall':'All', 'limitsnone':'None', 'limitsshow':'Show Limits'
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsand':'Show Seats'
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Seats'
}
# For use in date ranges.
@ -102,7 +102,7 @@ class Filters(threading.Thread):
vbox = gtk.VBox(False, 0)
self.sbSeats = {}
self.fillSeatsFrame(vbox)
self.fillSeatsFrame(vbox, display)
seatsFrame.add(vbox)
dateFrame = gtk.Frame("Date:")
@ -170,8 +170,10 @@ class Filters(threading.Thread):
return ltuple
def getSeats(self):
self.seats['from'] = self.sbSeats['from'].get_value_as_int()
self.seats['to'] = self.sbSeats['to'].get_value_as_int()
if 'from' in self.sbSeats:
self.seats['from'] = self.sbSeats['from'].get_value_as_int()
if 'to' in self.sbSeats:
self.seats['to'] = self.sbSeats['to'].get_value_as_int()
return self.seats
def getDates(self):
@ -307,7 +309,7 @@ class Filters(threading.Thread):
hbox.pack_start(vbox2, False, False, 0)
for i, line in enumerate(result):
hbox = gtk.HBox(False, 0)
if i < len(result)/2:
if i <= len(result)/2:
vbox1.pack_start(hbox, False, False, 0)
else:
vbox2.pack_start(hbox, False, False, 0)
@ -325,7 +327,7 @@ class Filters(threading.Thread):
else:
print "INFO: No games returned from database"
def fillSeatsFrame(self, vbox):
def fillSeatsFrame(self, vbox, display):
hbox = gtk.HBox(False, 0)
vbox.pack_start(hbox, False, True, 0)
@ -335,22 +337,28 @@ class Filters(threading.Thread):
sb1 = gtk.SpinButton(adjustment=adj1, climb_rate=0.0, digits=0)
adj2 = gtk.Adjustment(value=10, lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
cb = gtk.CheckButton(self.filterText['seatsand'])
cb.connect('clicked', self.__set_seat_select, 'show')
hbox.pack_start(lbl_from, expand=False, padding=3)
hbox.pack_start(sb1, False, False, 0)
hbox.pack_start(lbl_to, expand=False, padding=3)
hbox.pack_start(sb2, False, False, 0)
hbox = gtk.HBox(False, 0)
vbox.pack_start(hbox, False, True, 0)
hbox.pack_start(cb, False, False, 0)
if "SeatSep" in display and display["SeatSep"] == True:
hbox = gtk.HBox(False, 0)
vbox.pack_start(hbox, False, True, 0)
cb = gtk.CheckButton(self.filterText['seatsshow'])
cb.connect('clicked', self.__set_seat_select, 'show')
hbox.pack_start(cb, False, False, 0)
self.sbSeats['show'] = cb
self.seats['show'] = False
self.sbSeats['from'] = sb1
self.sbSeats['to'] = sb2
self.sbSeats['show'] = cb
self.seats['show'] = False
def fillCardsFrame(self, vbox):
hbox1 = gtk.HBox(True,0)

View File

@ -185,6 +185,13 @@ class FpdbSQLQueries:
importTime DATETIME NOT NULL,
seats SMALLINT NOT NULL,
maxSeats SMALLINT NOT NULL,
vpi SMALLINT NOT NULL,
street0Seen SMALLINT NOT NULL,
street1Seen SMALLINT NOT NULL,
street2Seen SMALLINT NOT NULL,
street3Seen SMALLINT NOT NULL,
street4Seen SMALLINT NOT NULL,
sdSeen SMALLINT NOT NULL,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
@ -198,6 +205,13 @@ class FpdbSQLQueries:
importTime timestamp without time zone,
seats SMALLINT,
maxSeats SMALLINT,
vpi SMALLINT NOT NULL,
street0Seen SMALLINT NOT NULL,
street1Seen SMALLINT NOT NULL,
street2Seen SMALLINT NOT NULL,
street3Seen SMALLINT NOT NULL,
street4Seen SMALLINT NOT NULL,
sdSeen SMALLINT NOT NULL,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
@ -306,7 +320,7 @@ class FpdbSQLQueries:
startCash INT NOT NULL,
position CHAR(1),
seatNo SMALLINT NOT NULL,
ante INT,
activeSeats SMALLINT NOT NULL,
card1Value smallint NOT NULL,
card1Suit char(1) NOT NULL,
@ -322,28 +336,104 @@ class FpdbSQLQueries:
card6Suit char(1),
card7Value smallint,
card7Suit char(1),
startCards smallint,
ante INT,
winnings int NOT NULL,
rake int NOT NULL,
totalProfit INT NOT NULL,
comment text,
commentTs DATETIME,
tourneysPlayersId BIGINT UNSIGNED,
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))
wonWhenSeenStreet1 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT NOT NULL,
wonWhenSeenStreet3 FLOAT NOT NULL,
wonWhenSeenStreet4 FLOAT NOT NULL,
wonAtSD FLOAT NOT NULL,
street0VPI BOOLEAN NOT NULL,
street0Aggr BOOLEAN NOT NULL,
street0_3BChance BOOLEAN NOT NULL,
street0_3BDone BOOLEAN NOT NULL,
street0_4BChance BOOLEAN NOT NULL,
street0_4BDone BOOLEAN NOT NULL,
other3BStreet0 BOOLEAN NOT NULL,
other4BStreet0 BOOLEAN NOT NULL,
street1Seen BOOLEAN NOT NULL,
street2Seen BOOLEAN NOT NULL,
street3Seen BOOLEAN NOT NULL,
street4Seen BOOLEAN NOT NULL,
sawShowdown BOOLEAN NOT NULL,
street1Aggr BOOLEAN NOT NULL,
street2Aggr BOOLEAN NOT NULL,
street3Aggr BOOLEAN NOT NULL,
street4Aggr BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN NOT NULL,
otherRaisedStreet1 BOOLEAN NOT NULL,
otherRaisedStreet2 BOOLEAN NOT NULL,
otherRaisedStreet3 BOOLEAN NOT NULL,
otherRaisedStreet4 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN NOT NULL,
foldToOtherRaisedStreet1 BOOLEAN NOT NULL,
foldToOtherRaisedStreet2 BOOLEAN NOT NULL,
foldToOtherRaisedStreet3 BOOLEAN NOT NULL,
foldToOtherRaisedStreet4 BOOLEAN NOT NULL,
stealAttemptChance BOOLEAN NOT NULL,
stealAttempted BOOLEAN NOT NULL,
foldBbToStealChance BOOLEAN NOT NULL,
foldedBbToSteal BOOLEAN NOT NULL,
foldSbToStealChance BOOLEAN NOT NULL,
foldedSbToSteal BOOLEAN NOT NULL,
street1CBChance BOOLEAN NOT NULL,
street1CBDone BOOLEAN NOT NULL,
street2CBChance BOOLEAN NOT NULL,
street2CBDone BOOLEAN NOT NULL,
street3CBChance BOOLEAN NOT NULL,
street3CBDone BOOLEAN NOT NULL,
street4CBChance BOOLEAN NOT NULL,
street4CBDone BOOLEAN NOT NULL,
foldToStreet1CBChance BOOLEAN NOT NULL,
foldToStreet1CBDone BOOLEAN NOT NULL,
foldToStreet2CBChance BOOLEAN NOT NULL,
foldToStreet2CBDone BOOLEAN NOT NULL,
foldToStreet3CBChance BOOLEAN NOT NULL,
foldToStreet3CBDone BOOLEAN NOT NULL,
foldToStreet4CBChance BOOLEAN NOT NULL,
foldToStreet4CBDone BOOLEAN NOT NULL,
street1CheckCallRaiseChance BOOLEAN NOT NULL,
street1CheckCallRaiseDone BOOLEAN NOT NULL,
street2CheckCallRaiseChance BOOLEAN NOT NULL,
street2CheckCallRaiseDone BOOLEAN NOT NULL,
street3CheckCallRaiseChance BOOLEAN NOT NULL,
street3CheckCallRaiseDone BOOLEAN NOT NULL,
street4CheckCallRaiseChance BOOLEAN NOT NULL,
street4CheckCallRaiseDone BOOLEAN NOT NULL,
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createHandsPlayersTable'] = """CREATE TABLE HandsPlayers (
id BIGSERIAL, PRIMARY KEY (id),
handId BIGINT, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
startCash INT,
handId BIGINT NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
startCash INT NOT NULL,
position CHAR(1),
seatNo SMALLINT,
ante INT,
seatNo SMALLINT NOT NULL,
activeSeats SMALLINT NOT NULL,
card1Value smallint,
card1Suit char(1),
card2Value smallint,
card2Suit char(1),
card1Value smallint NOT NULL,
card1Suit char(1) NOT NULL,
card2Value smallint NOT NULL,
card2Suit char(1) NOT NULL,
card3Value smallint,
card3Suit char(1),
card4Value smallint,
@ -354,12 +444,89 @@ class FpdbSQLQueries:
card6Suit char(1),
card7Value smallint,
card7Suit char(1),
startCards smallint,
winnings int,
rake int,
ante INT,
winnings int NOT NULL,
rake int NOT NULL,
totalProfit INT NOT NULL,
comment text,
commentTs timestamp without time zone,
tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
tourneysPlayersId BIGINT,
tourneyTypeId INT NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
wonWhenSeenStreet1 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT NOT NULL,
wonWhenSeenStreet3 FLOAT NOT NULL,
wonWhenSeenStreet4 FLOAT NOT NULL,
wonAtSD FLOAT NOT NULL,
street0VPI BOOLEAN NOT NULL,
street0Aggr BOOLEAN NOT NULL,
street0_3BChance BOOLEAN NOT NULL,
street0_3BDone BOOLEAN NOT NULL,
street0_4BChance BOOLEAN NOT NULL,
street0_4BDone BOOLEAN NOT NULL,
other3BStreet0 BOOLEAN NOT NULL,
other4BStreet0 BOOLEAN NOT NULL,
street1Seen BOOLEAN NOT NULL,
street2Seen BOOLEAN NOT NULL,
street3Seen BOOLEAN NOT NULL,
street4Seen BOOLEAN NOT NULL,
sawShowdown BOOLEAN NOT NULL,
street1Aggr BOOLEAN NOT NULL,
street2Aggr BOOLEAN NOT NULL,
street3Aggr BOOLEAN NOT NULL,
street4Aggr BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN NOT NULL,
otherRaisedStreet1 BOOLEAN NOT NULL,
otherRaisedStreet2 BOOLEAN NOT NULL,
otherRaisedStreet3 BOOLEAN NOT NULL,
otherRaisedStreet4 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN NOT NULL,
foldToOtherRaisedStreet1 BOOLEAN NOT NULL,
foldToOtherRaisedStreet2 BOOLEAN NOT NULL,
foldToOtherRaisedStreet3 BOOLEAN NOT NULL,
foldToOtherRaisedStreet4 BOOLEAN NOT NULL,
stealAttemptChance BOOLEAN NOT NULL,
stealAttempted BOOLEAN NOT NULL,
foldBbToStealChance BOOLEAN NOT NULL,
foldedBbToSteal BOOLEAN NOT NULL,
foldSbToStealChance BOOLEAN NOT NULL,
foldedSbToSteal BOOLEAN NOT NULL,
street1CBChance BOOLEAN NOT NULL,
street1CBDone BOOLEAN NOT NULL,
street2CBChance BOOLEAN NOT NULL,
street2CBDone BOOLEAN NOT NULL,
street3CBChance BOOLEAN NOT NULL,
street3CBDone BOOLEAN NOT NULL,
street4CBChance BOOLEAN NOT NULL,
street4CBDone BOOLEAN NOT NULL,
foldToStreet1CBChance BOOLEAN NOT NULL,
foldToStreet1CBDone BOOLEAN NOT NULL,
foldToStreet2CBChance BOOLEAN NOT NULL,
foldToStreet2CBDone BOOLEAN NOT NULL,
foldToStreet3CBChance BOOLEAN NOT NULL,
foldToStreet3CBDone BOOLEAN NOT NULL,
foldToStreet4CBChance BOOLEAN NOT NULL,
foldToStreet4CBDone BOOLEAN NOT NULL,
street1CheckCallRaiseChance BOOLEAN NOT NULL,
street1CheckCallRaiseDone BOOLEAN NOT NULL,
street2CheckCallRaiseChance BOOLEAN NOT NULL,
street2CheckCallRaiseDone BOOLEAN NOT NULL,
street3CheckCallRaiseChance BOOLEAN NOT NULL,
street3CheckCallRaiseDone BOOLEAN NOT NULL,
street4CheckCallRaiseChance BOOLEAN NOT NULL,
street4CheckCallRaiseDone BOOLEAN NOT NULL,
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
elif(self.dbname == 'SQLite'):
self.query['createHandsPlayersTable'] = """ """
@ -400,7 +567,7 @@ class FpdbSQLQueries:
if(self.dbname == 'MySQL InnoDB'):
self.query['createHandsActionsTable'] = """CREATE TABLE HandsActions (
id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
handPlayerId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
handsPlayerId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
street SMALLINT NOT NULL,
actionNo SMALLINT NOT NULL,
action CHAR(5) NOT NULL,
@ -412,7 +579,7 @@ class FpdbSQLQueries:
elif(self.dbname == 'PostgreSQL'):
self.query['createHandsActionsTable'] = """CREATE TABLE HandsActions (
id BIGSERIAL, PRIMARY KEY (id),
handPlayerId BIGINT, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
handsPlayerId BIGINT, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
street SMALLINT,
actionNo SMALLINT,
action CHAR(5),
@ -611,12 +778,10 @@ class FpdbSQLQueries:
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
self.query['getRingProfitAllHandsPlayerIdSite'] = """
SELECT hp.handId, hp.winnings, coalesce(hp.ante,0) + SUM(ha.amount)
, hp.winnings - (coalesce(hp.ante,0) + SUM(ha.amount))
SELECT hp.handId, hp.totalProfit, hp.totalProfit, hp.totalProfit
FROM HandsPlayers hp
INNER JOIN Players pl ON hp.playerId = pl.id
INNER JOIN Hands h ON h.id = hp.handId
INNER JOIN HandsActions ha ON ha.handPlayerId = hp.id
INNER JOIN Gametypes g ON h.gametypeId = g.id
where pl.id in <player_test>
AND pl.siteId in <site_test>
@ -624,9 +789,74 @@ class FpdbSQLQueries:
AND h.handStart < '<enddate_test>'
AND g.bigBlind in <limit_test>
AND hp.tourneysPlayersId IS NULL
GROUP BY hp.handId, hp.winnings, h.handStart, hp.ante
GROUP BY h.handStart, hp.handId, hp.totalProfit
ORDER BY h.handStart"""
if self.dbname in ['MySQL InnoDB', 'PostgreSQL']:
self.query['playerDetailedStats'] = """
select
h.gametypeId
,sum(hp.totalProfit) AS sum_profit
,avg(hp.totalProfit/100.0) AS profitperhand
/*,case when h.gametypeId = -1 then -999
else variance(hp.totalProfit/100.0)
end AS variance*/
,gt.base
,gt.category
,upper(gt.limitType) AS limitType
,s.name
/*,<selectgt.bigBlind> AS bigBlindDesc
,<hcgametypeId> AS gtId*/
,count(1) AS n
,100.0*sum(cast(street0VPI as integer))/count(1) AS vpip
,100.0*sum(cast(street0Aggr as integer))/count(1) AS pfr
,case when sum(cast(street0_3b4bchance as integer)) = 0 then '0'
else 100.0*sum(cast(street0_3b4bdone as integer))/sum(cast(street0_3b4bchance as integer))
end AS pf3
,case when sum(cast(stealattemptchance as integer)) = 0 then -999
else 100.0*sum(cast(stealattempted as integer))/sum(cast(stealattemptchance as integer))
end AS steals
,100.0*sum(cast(street1Seen as integer))/count(1) AS saw_f
,100.0*sum(cast(sawShowdown as integer))/count(1) AS sawsd
,case when sum(cast(street1Seen as integer)) = 0 then -999
else 100.0*sum(cast(sawShowdown as integer))/sum(cast(street1Seen as integer))
end AS wtsdwsf
,case when sum(cast(sawShowdown as integer)) = 0 then -999
else 100.0*sum(cast(wonAtSD as integer))/sum(cast(sawShowdown as integer))
end AS wmsd
,case when sum(cast(street1Seen as integer)) = 0 then -999
else 100.0*sum(cast(street1Aggr as integer))/sum(cast(street1Seen as integer))
end AS FlAFq
,case when sum(cast(street2Seen as integer)) = 0 then -999
else 100.0*sum(cast(street2Aggr as integer))/sum(cast(street2Seen as integer))
end AS TuAFq
,case when sum(cast(street3Seen as integer)) = 0 then -999
else 100.0*sum(cast(street3Aggr as integer))/sum(cast(street3Seen as integer))
end AS RvAFq
,case when sum(cast(street1Seen as integer))+sum(cast(street2Seen as integer))+sum(cast(street3Seen as integer)) = 0 then -999
else 100.0*(sum(cast(street1Aggr as integer))+sum(cast(street2Aggr as integer))+sum(cast(street3Aggr as integer)))
/(sum(cast(street1Seen as integer))+sum(cast(street2Seen as integer))+sum(cast(street3Seen as integer)))
end AS PoFAFq
,sum(totalProfit)/100.0 AS Net
,(sum(totalProfit/(gt.bigBlind+0.0))) / (count(1)/100.0)
AS BBper100
,(sum(totalProfit)/100.0) / count(1) AS Profitperhand
,sum(activeSeats)/(count(1)+0.0) AS AvgSeats
from HandsPlayers hp
inner join Hands h on (h.id = hp.handId)
inner join Gametypes gt on (gt.Id = h.gameTypeId)
inner join Sites s on (s.Id = gt.siteId)
where hp.playerId in (1) /* <player_test> */
and hp.tourneysPlayersId IS NULL
group by h.gametypeId
,hp.playerId
,gt.base
,gt.category
,upper(gt.limitType)
,s.name"""
elif(self.dbname == 'SQLite'):
self.query['playerDetailedStats'] = """ """
if(self.dbname == 'MySQL InnoDB'):
self.query['playerStats'] = """
SELECT
@ -697,7 +927,7 @@ class FpdbSQLQueries:
,format((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0),2)
AS BBper100
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
,format( avg(activeSeats), 1) AS AvgSeats
,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
@ -719,19 +949,17 @@ class FpdbSQLQueries:
else variance(hprof.profit/100.0)
end as variance
from
(select hp.handId, <hgameTypeId> as gtId, hp.winnings, SUM(ha.amount) as costs
, hp.winnings - SUM(ha.amount) as profit
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit
from HandsPlayers hp
inner join Hands h ON h.id = hp.handId
left join HandsActions ha ON ha.handPlayerId = hp.id
where hp.playerId in <player_test>
and hp.tourneysPlayersId IS NULL
group by hp.handId, gtId, hp.position, hp.winnings
group by hp.handId, gtId, hp.totalProfit
) hprof
group by hprof.gtId
) hprof2
on hprof2.gtId = stats.gtId
order by stats.category, stats.limittype, stats.bigBlindDesc <orderbyseats>"""
order by stats.category, stats.limittype, stats.bigBlindDesc desc <orderbyseats>"""
elif(self.dbname == 'PostgreSQL'):
self.query['playerStats'] = """
SELECT upper(stats.limitType) || ' '
@ -799,7 +1027,7 @@ class FpdbSQLQueries:
,to_char((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0), '990D00')
AS BBper100
,to_char(sum(totalProfit/100.0) / (sum(HDs)+0.0), '990D0000') AS Profitperhand
,to_char(avg(activeSeats),'90D0') AS AvgSeats
,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
@ -821,19 +1049,17 @@ class FpdbSQLQueries:
else variance(hprof.profit/100.0)
end as variance
from
(select hp.handId, <hgameTypeId> as gtId, hp.winnings,
SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
(select hp.handId, <hgameTypeId> as gtId, hp.totalProfit as profit
from HandsPlayers hp
inner join Hands h ON (h.id = hp.handId)
left join HandsActions ha ON (ha.handPlayerId = hp.id)
inner join Hands h ON (h.id = hp.handId)
where hp.playerId in <player_test>
and hp.tourneysPlayersId IS NULL
group by hp.handId, gtId, hp.position, hp.winnings
group by hp.handId, gtId, hp.totalProfit
) hprof
group by hprof.gtId
) hprof2
on hprof2.gtId = stats.gtId
order by stats.base, stats.limittype, stats.bigBlindDesc <orderbyseats>"""
order by stats.base, stats.limittype, stats.bigBlindDesc desc <orderbyseats>"""
elif(self.dbname == 'SQLite'):
self.query['playerStats'] = """ """
@ -923,7 +1149,7 @@ class FpdbSQLQueries:
,format((sum(totalProfit/(gt.bigBlind+0.0))) / (sum(HDs)/100.0),2)
AS BBper100
,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand
,format( avg(activeSeats), 1) AS AvgSeats
,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
@ -954,20 +1180,19 @@ class FpdbSQLQueries:
else variance(hprof.profit/100.0)
end as variance
from
(select hp.handId, <hgameTypeId> as gtId, hp.position, hp.winnings
, SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
(select hp.handId, <hgameTypeId> as gtId, hp.position
, hp.totalProfit as profit
from HandsPlayers hp
inner join Hands h ON h.id = hp.handId
left join HandsActions ha ON ha.handPlayerId = hp.id
inner join Hands h ON (h.id = hp.handId)
where hp.playerId in <player_test>
and hp.tourneysPlayersId IS NULL
group by hp.handId, gtId, hp.position, hp.winnings
group by hp.handId, gtId, hp.position, hp.totalProfit
) hprof
group by hprof.gtId, PlPosition
) hprof2
on ( hprof2.gtId = stats.gtId
and hprof2.PlPosition = stats.PlPosition)
order by stats.category, stats.limitType, stats.bigBlindDesc
order by stats.category, stats.limitType, stats.bigBlindDesc desc
<orderbyseats>, cast(stats.PlPosition as signed)
"""
elif(self.dbname == 'PostgreSQL'):
@ -1058,7 +1283,7 @@ class FpdbSQLQueries:
,case when sum(HDs) = 0 then '0'
else to_char( (sum(totalProfit)/100.0) / sum(HDs), '90D0000')
end AS Profitperhand
,to_char(avg(activeSeats),'90D0') AS AvgSeats
,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)
@ -1089,20 +1314,19 @@ class FpdbSQLQueries:
else variance(hprof.profit/100.0)
end as variance
from
(select hp.handId, <hgameTypeId> as gtId, hp.position, hp.winnings
, SUM(ha.amount) as costs, hp.winnings - SUM(ha.amount) as profit
(select hp.handId, <hgameTypeId> as gtId, hp.position
, hp.totalProfit as profit
from HandsPlayers hp
inner join Hands h ON h.id = hp.handId
left join HandsActions ha ON ha.handPlayerId = hp.id
inner join Hands h ON (h.id = hp.handId)
where hp.playerId in <player_test>
and hp.tourneysPlayersId IS NULL
group by hp.handId, gameTypeId, hp.position, hp.winnings
group by hp.handId, gameTypeId, hp.position, hp.totalProfit
) hprof
group by hprof.gtId, PlPosition
) hprof2
on ( hprof2.gtId = stats.gtId
and hprof2.PlPosition = stats.PlPosition)
order by stats.category, stats.limitType, stats.bigBlindDesc
order by stats.category, stats.limitType, stats.bigBlindDesc desc
<orderbyseats>, cast(stats.PlPosition as smallint)
"""
elif(self.dbname == 'SQLite'):
@ -1245,6 +1469,160 @@ class FpdbSQLQueries:
self.query['getLimits'] = """SELECT DISTINCT bigBlind from Gametypes ORDER by bigBlind DESC"""
####################################
# Queries to rebuild/modify hudcache
####################################
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
self.query['clearHudCache'] = """DELETE FROM HudCache"""
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
self.query['rebuildHudCache'] = """
INSERT INTO HudCache
(gametypeId
,playerId
,activeSeats
,position
,tourneyTypeId
,HDs
,wonWhenSeenStreet1
,wonAtSD
,street0VPI
,street0Aggr
,street0_3B4BChance
,street0_3B4BDone
,street1Seen
,street2Seen
,street3Seen
,street4Seen
,sawShowdown
,street1Aggr
,street2Aggr
,street3Aggr
,street4Aggr
,otherRaisedStreet1
,otherRaisedStreet2
,otherRaisedStreet3
,otherRaisedStreet4
,foldToOtherRaisedStreet1
,foldToOtherRaisedStreet2
,foldToOtherRaisedStreet3
,foldToOtherRaisedStreet4
,stealAttemptChance
,stealAttempted
,foldBbToStealChance
,foldedBbToSteal
,foldSbToStealChance
,foldedSbToSteal
,street1CBChance
,street1CBDone
,street2CBChance
,street2CBDone
,street3CBChance
,street3CBDone
,street4CBChance
,street4CBDone
,foldToStreet1CBChance
,foldToStreet1CBDone
,foldToStreet2CBChance
,foldToStreet2CBDone
,foldToStreet3CBChance
,foldToStreet3CBDone
,foldToStreet4CBChance
,foldToStreet4CBDone
,totalProfit
,street1CheckCallRaiseChance
,street1CheckCallRaiseDone
,street2CheckCallRaiseChance
,street2CheckCallRaiseDone
,street3CheckCallRaiseChance
,street3CheckCallRaiseDone
,street4CheckCallRaiseChance
,street4CheckCallRaiseDone
)
SELECT h.gametypeId
,hp.playerId
,hp.activeSeats
,case when hp.position = 'B' then 'B'
when hp.position = 'S' then 'S'
when hp.position = '0' then 'D'
when hp.position = '1' then 'C'
when hp.position = '2' then 'M'
when hp.position = '3' then 'M'
when hp.position = '4' then 'M'
when hp.position = '5' then 'E'
when hp.position = '6' then 'E'
when hp.position = '7' then 'E'
when hp.position = '8' then 'E'
when hp.position = '9' then 'E'
else 'E'
end AS hc_position
,hp.tourneyTypeId
,count(1)
,sum(wonWhenSeenStreet1)
,sum(wonAtSD)
,sum(CAST(street0VPI as integer))
,sum(CAST(street0Aggr as integer))
,sum(CAST(street0_3B4BChance as integer))
,sum(CAST(street0_3B4BDone as integer))
,sum(CAST(street1Seen as integer))
,sum(CAST(street2Seen as integer))
,sum(CAST(street3Seen as integer))
,sum(CAST(street4Seen as integer))
,sum(CAST(sawShowdown as integer))
,sum(CAST(street1Aggr as integer))
,sum(CAST(street2Aggr as integer))
,sum(CAST(street3Aggr as integer))
,sum(CAST(street4Aggr as integer))
,sum(CAST(otherRaisedStreet1 as integer))
,sum(CAST(otherRaisedStreet2 as integer))
,sum(CAST(otherRaisedStreet3 as integer))
,sum(CAST(otherRaisedStreet4 as integer))
,sum(CAST(foldToOtherRaisedStreet1 as integer))
,sum(CAST(foldToOtherRaisedStreet2 as integer))
,sum(CAST(foldToOtherRaisedStreet3 as integer))
,sum(CAST(foldToOtherRaisedStreet4 as integer))
,sum(CAST(stealAttemptChance as integer))
,sum(CAST(stealAttempted as integer))
,sum(CAST(foldBbToStealChance as integer))
,sum(CAST(foldedBbToSteal as integer))
,sum(CAST(foldSbToStealChance as integer))
,sum(CAST(foldedSbToSteal as integer))
,sum(CAST(street1CBChance as integer))
,sum(CAST(street1CBDone as integer))
,sum(CAST(street2CBChance as integer))
,sum(CAST(street2CBDone as integer))
,sum(CAST(street3CBChance as integer))
,sum(CAST(street3CBDone as integer))
,sum(CAST(street4CBChance as integer))
,sum(CAST(street4CBDone as integer))
,sum(CAST(foldToStreet1CBChance as integer))
,sum(CAST(foldToStreet1CBDone as integer))
,sum(CAST(foldToStreet2CBChance as integer))
,sum(CAST(foldToStreet2CBDone as integer))
,sum(CAST(foldToStreet3CBChance as integer))
,sum(CAST(foldToStreet3CBDone as integer))
,sum(CAST(foldToStreet4CBChance as integer))
,sum(CAST(foldToStreet4CBDone as integer))
,sum(CAST(totalProfit as integer))
,sum(CAST(street1CheckCallRaiseChance as integer))
,sum(CAST(street1CheckCallRaiseDone as integer))
,sum(CAST(street2CheckCallRaiseChance as integer))
,sum(CAST(street2CheckCallRaiseDone as integer))
,sum(CAST(street3CheckCallRaiseChance as integer))
,sum(CAST(street3CheckCallRaiseDone as integer))
,sum(CAST(street4CheckCallRaiseChance as integer))
,sum(CAST(street4CheckCallRaiseDone as integer))
FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId)
GROUP BY h.gametypeId
,hp.playerId
,hp.activeSeats
,hc_position
,hp.tourneyTypeId
"""
if __name__== "__main__":
from optparse import OptionParser

View File

@ -57,6 +57,7 @@ class GuiGraphViewer (threading.Thread):
"Sites" : True,
"Games" : True,
"Limits" : True,
"Seats" : False,
"Dates" : True,
"Button1" : True,
"Button2" : True
@ -73,10 +74,12 @@ class GuiGraphViewer (threading.Thread):
self.leftPanelBox = self.filters.get_vbox()
self.graphBox = gtk.VBox(False, 0)
self.graphBox.show()
self.hpane = gtk.HPaned()
self.hpane.pack1(self.leftPanelBox)
self.hpane.pack2(self.graphBox)
self.hpane.show()
self.mainHBox.add(self.hpane)
@ -86,7 +89,7 @@ class GuiGraphViewer (threading.Thread):
self.fig = Figure(figsize=(5,4), dpi=100)
self.canvas = None
self.mainHBox.show_all()
self.db.db.rollback()
#################################
@ -175,7 +178,8 @@ class GuiGraphViewer (threading.Thread):
self.ax.set_xlabel("Hands", fontsize = 12)
self.ax.set_ylabel("$", fontsize = 12)
self.ax.grid(color='g', linestyle=':', linewidth=0.2)
if(line == None):
if line == None or line == []:
#TODO: Do something useful like alert user
print "No hands returned by graph query"
else:
@ -193,7 +197,7 @@ class GuiGraphViewer (threading.Thread):
self.graphBox.add(self.canvas)
self.canvas.show()
self.exportButton.set_sensitive(True)
#self.exportButton.set_sensitive(True)
#end of def showClicked
def getRingProfitGraph(self, names, sites, limits):

View File

@ -51,6 +51,7 @@ class GuiPlayerStats (threading.Thread):
"Games" : False,
"Limits" : True,
"LimitSep" : True,
"Seats" : True,
"Dates" : False,
"Button1" : True,
"Button2" : False
@ -123,7 +124,8 @@ class GuiPlayerStats (threading.Thread):
tmp = self.refineQuery(tmp, playerids, sitenos, limits, seats)
self.cursor.execute(tmp)
result = self.cursor.fetchall()
cols = 18
cols = 19
rows = len(result)+1 # +1 for title row
self.stats_table = gtk.Table(rows, cols, False)
self.stats_table.set_col_spacings(4)
@ -131,7 +133,7 @@ class GuiPlayerStats (threading.Thread):
vbox.add(self.stats_table)
# Create header row
titles = ("Game", "Hands", "VPIP", "PFR", "PF3", "Steals", "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq", "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance")
titles = ("Game", "Hands", "VPIP", "PFR", "PF3", "Steals", "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq", "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance", "AvgSeats")
col = 0
row = 0

View File

@ -52,6 +52,7 @@ class GuiPositionalStats (threading.Thread):
"Limits" : True,
"LimitSep" : True,
"Seats" : True,
"SeatSep" : True,
"Dates" : False,
"Button1" : True,
"Button2" : False
@ -142,26 +143,35 @@ class GuiPositionalStats (threading.Thread):
self.createStatsTable(vbox, playerids, sitenos, limits, seats)
def createStatsTable(self, vbox, playerids, sitenos, limits, seats):
tmp = self.sql.query['playerStatsByPosition']
tmp = self.refineQuery(tmp, playerids, sitenos, limits, seats)
self.cursor.execute(tmp)
result = self.cursor.fetchall()
self.stats_table = gtk.Table(1, 1, False) # gtk table expands as required
self.stats_table.set_col_spacings(4)
self.stats_table.show()
vbox.add(self.stats_table)
colnames = [desc[0].lower() for desc in self.cursor.description]
rows = len(result)
row = 0
col = 0
row = 0
for t in self.posnheads:
l = gtk.Label(self.posnheads[col])
l.show()
self.stats_table.attach(l, col, col+1, row, row+1, yoptions=gtk.SHRINK)
col +=1
tmp = self.sql.query['playerStatsByPosition']
tmp = self.refineQuery(tmp, playerids, sitenos, limits, seats)
self.cursor.execute(tmp)
result = self.cursor.fetchall()
rows = len(result)
colnames = [desc[0].lower() for desc in self.cursor.description]
last_game,last_seats,sqlrow = "","",0
while sqlrow < rows:
if(row%2 == 0):

View File

@ -195,6 +195,7 @@ class HUD_main(object):
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
else:
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, stat_dict, cards)
self.db_connection.connection.rollback()
if __name__== "__main__":
sys.stderr.write("HUD_main starting\n")

View File

@ -187,10 +187,10 @@ def prepareBulkImport(fdb):
# mod to use tab_col for index name?
try:
fdb.cursor.execute( "drop index %s_%s_idx" % (idx['tab'],idx['col']) )
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
#print "dropped pg index ", idx['tab'], idx['col']
except:
print "! failed drop index %s_%s_idx" % (idx['tab'],idx['col'])
print "! failed drop index %s_%s_idx" % (idx['tab'],idx['col'])
else:
print "Only MySQL and Postgres supported so far"
return -1
@ -1065,7 +1065,7 @@ def parsePositions(hand, names):
if bb != -1:
bb = recognisePlayerNo(bb, names, "bet")
# print "sb = ", sb, "bb = ", bb
# print "sb = ", sb, "bb = ", bb
if bb == sb: # if big and small are same, then don't duplicate the small
sbExists = False
sb = -1
@ -1114,7 +1114,7 @@ def parsePositions(hand, names):
print "parsePositions names:",names
print "result:",positions
raise FpdbError ("failed to read positions")
# print str(positions), "\n"
# print str(positions), "\n"
return positions
#end def parsePositions
@ -1438,6 +1438,7 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac
def store_board_cards(cursor, hands_id, board_values, board_suits):
#stores into table board_cards
return
cursor.execute ("""INSERT INTO BoardCards (handId, card1Value, card1Suit,
card2Value, card2Suit, card3Value, card3Suit, card4Value, card4Suit,
card5Value, card5Suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
@ -1458,35 +1459,128 @@ def storeHands(backend, conn, cursor, site_hand_no, gametype_id
#end def storeHands
def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id, player_ids, start_cashes
,positions, card_values, card_suits, winnings, rakes, seatNos):
,positions, card_values, card_suits, winnings, rakes, seatNos, hudCache):
result=[]
# postgres (and others?) needs the booleans converted to ints before saving:
# (or we could just save them as boolean ... but then we can't sum them so easily in sql ???)
# NO - storing booleans for now so don't need this
#hudCacheInt = {}
#for k,v in hudCache.iteritems():
# if k in ('wonWhenSeenStreet1', 'wonAtSD', 'totalProfit'):
# hudCacheInt[k] = v
# else:
# hudCacheInt[k] = map(lambda x: 1 if x else 0, v)
if (category=="holdem"):
for i in xrange(len(player_ids)):
x,y = card_values[i][0],card_values[i][1]
if (card_suits[i][0] == card_suits[i][1] and x < y) or (card_suits[i][0] != card_suits[i][1] and x > y):
x,y = y,x
startCards = 13 * (x-2) + (y-2)
cursor.execute ("""
INSERT INTO HandsPlayers
(handId, playerId, startCash, position,
card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i], seatNos[i]))
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo, totalProfit,
street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
otherRaisedStreet1, otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4,
foldToOtherRaisedStreet1, foldToOtherRaisedStreet2, foldToOtherRaisedStreet3, foldToOtherRaisedStreet4,
wonWhenSeenStreet1, wonAtSD,
stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal,
street1CBChance, street1CBDone, street2CBChance, street2CBDone,
street3CBChance, street3CBDone, street4CBChance, street4CBDone,
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone
)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], len(player_ids), 1, # tourneytypeid
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
hudCache['street0VPI'][i], hudCache['street0Aggr'][i],
hudCache['street0_3B4BChance'][i], hudCache['street0_3B4BDone'][i],
hudCache['street1Seen'][i], hudCache['street2Seen'][i], hudCache['street3Seen'][i],
hudCache['street4Seen'][i], hudCache['sawShowdown'][i],
hudCache['street1Aggr'][i], hudCache['street2Aggr'][i], hudCache['street3Aggr'][i], hudCache['street4Aggr'][i],
hudCache['otherRaisedStreet1'][i], hudCache['otherRaisedStreet2'][i],
hudCache['otherRaisedStreet3'][i], hudCache['otherRaisedStreet4'][i],
hudCache['foldToOtherRaisedStreet1'][i], hudCache['foldToOtherRaisedStreet2'][i],
hudCache['foldToOtherRaisedStreet3'][i], hudCache['foldToOtherRaisedStreet4'][i],
hudCache['wonWhenSeenStreet1'][i], hudCache['wonAtSD'][i],
hudCache['stealAttemptChance'][i], hudCache['stealAttempted'][i], hudCache['foldBbToStealChance'][i],
hudCache['foldedBbToSteal'][i], hudCache['foldSbToStealChance'][i], hudCache['foldedSbToSteal'][i],
hudCache['street1CBChance'][i], hudCache['street1CBDone'][i], hudCache['street2CBChance'][i], hudCache['street2CBDone'][i],
hudCache['street3CBChance'][i], hudCache['street3CBDone'][i], hudCache['street4CBChance'][i], hudCache['street4CBDone'][i],
hudCache['foldToStreet1CBChance'][i], hudCache['foldToStreet1CBDone'][i],
hudCache['foldToStreet2CBChance'][i], hudCache['foldToStreet2CBDone'][i],
hudCache['foldToStreet3CBChance'][i], hudCache['foldToStreet3CBDone'][i],
hudCache['foldToStreet4CBChance'][i], hudCache['foldToStreet4CBDone'][i],
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i]
) )
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
#result.append(cursor.fetchall()[0][0])
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
result.append( getLastInsertId(backend, conn, cursor) )
elif (category=="omahahi" or category=="omahahilo"):
for i in xrange(len(player_ids)):
cursor.execute ("""INSERT INTO HandsPlayers
(handId, playerId, startCash, position,
card1Value, card1Suit, card2Value, card2Suit,
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
winnings[i], rakes[i], seatNos[i]))
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
card1Value, card1Suit, card2Value, card2Suit,
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo, totalProfit,
street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
otherRaisedStreet1, otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4,
foldToOtherRaisedStreet1, foldToOtherRaisedStreet2, foldToOtherRaisedStreet3, foldToOtherRaisedStreet4,
wonWhenSeenStreet1, wonAtSD,
stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal,
street1CBChance, street1CBDone, street2CBChance, street2CBDone,
street3CBChance, street3CBDone, street4CBChance, street4CBDone,
foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone,
foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone,
street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone,
street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone
)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], len(player_ids), 1, # tourneytypeid
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
hudCache['street0VPI'][i], hudCache['street0Aggr'][i],
hudCache['street0_3B4BChance'][i], hudCache['street0_3B4BDone'][i],
hudCache['street1Seen'][i], hudCache['street2Seen'][i], hudCache['street3Seen'][i],
hudCache['street4Seen'][i], hudCache['sawShowdown'][i],
hudCache['street1Aggr'][i], hudCache['street2Aggr'][i], hudCache['street3Aggr'][i], hudCache['street4Aggr'][i],
hudCache['otherRaisedStreet1'][i], hudCache['otherRaisedStreet2'][i],
hudCache['otherRaisedStreet3'][i], hudCache['otherRaisedStreet4'][i],
hudCache['foldToOtherRaisedStreet1'][i], hudCache['foldToOtherRaisedStreet2'][i],
hudCache['foldToOtherRaisedStreet3'][i], hudCache['foldToOtherRaisedStreet4'][i],
hudCache['wonWhenSeenStreet1'][i], hudCache['wonAtSD'][i],
hudCache['stealAttemptChance'][i], hudCache['stealAttempted'][i], hudCache['foldBbToStealChance'][i],
hudCache['foldedBbToSteal'][i], hudCache['foldSbToStealChance'][i], hudCache['foldedSbToSteal'][i],
hudCache['street1CBChance'][i], hudCache['street1CBDone'][i], hudCache['street2CBChance'][i], hudCache['street2CBDone'][i],
hudCache['street3CBChance'][i], hudCache['street3CBDone'][i], hudCache['street4CBChance'][i], hudCache['street4CBDone'][i],
hudCache['foldToStreet1CBChance'][i], hudCache['foldToStreet1CBDone'][i],
hudCache['foldToStreet2CBChance'][i], hudCache['foldToStreet2CBDone'][i],
hudCache['foldToStreet3CBChance'][i], hudCache['foldToStreet3CBDone'][i],
hudCache['foldToStreet4CBChance'][i], hudCache['foldToStreet4CBDone'][i],
hudCache['street1CheckCallRaiseChance'][i], hudCache['street1CheckCallRaiseDone'][i],
hudCache['street2CheckCallRaiseChance'][i], hudCache['street2CheckCallRaiseDone'][i],
hudCache['street3CheckCallRaiseChance'][i], hudCache['street3CheckCallRaiseDone'][i],
hudCache['street4CheckCallRaiseChance'][i], hudCache['street4CheckCallRaiseDone'][i]
) )
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
#result.append(cursor.fetchall()[0][0])
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
result.append( getLastInsertId(backend, conn, cursor) )
else:
raise FpdbError("invalid category")
return result
@ -1513,7 +1607,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
card_values[i][6], card_suits[i][6], winnings[i], rakes[i], seatNos[i]))
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
#result.append(cursor.fetchall()[0][0])
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
result.append( getLastInsertId(backend, conn, cursor) )
return result
#end def store_hands_players_stud
@ -1547,7 +1641,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
raise FpdbError ("invalid card_values length:"+str(len(card_values[0])))
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
#result.append(cursor.fetchall()[0][0])
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
result.append( getLastInsertId(backend, conn, cursor) )
return result
#end def store_hands_players_holdem_omaha_tourney
@ -1572,7 +1666,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
card_values[i][6], card_suits[i][6], winnings[i], rakes[i], tourneys_players_ids[i], seatNos[i]))
#cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId+0=%s", (hands_id, player_ids[i]))
#result.append(cursor.fetchall()[0][0])
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
result.append( getLastInsertId(backend, conn, cursor) )
return result
#end def store_hands_players_stud_tourney