screwed up previous release using branches, this should work now (added hc fields as well as hp, made new fields NULLable, use 3b not 3b4b fields), next job calculate some of these fields ...

This commit is contained in:
sqlcoder 2009-05-17 17:26:05 +01:00
parent a5884ff7ae
commit e2137a596a
5 changed files with 186 additions and 162 deletions

View File

@ -26,8 +26,10 @@ class DerivedStats():
self.HDs = 0
self.street0VPI = 0
self.street0Aggr = 0
self.street0_3B4BChance = 0
self.street0_3B4BDone = 0
self.street0_3BChance = 0
self.street0_3BDone = 0
self.street0_4BChance = 0
self.street0_4BDone = 0
self.street1Seen = 0
self.street2Seen = 0

View File

@ -185,13 +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,
vpi SMALLINT,
street0Seen SMALLINT,
street1Seen SMALLINT,
street2Seen SMALLINT,
street3Seen SMALLINT,
street4Seen SMALLINT,
sdSeen SMALLINT,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
@ -205,13 +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,
vpi SMALLINT,
street0Seen SMALLINT,
street1Seen SMALLINT,
street2Seen SMALLINT,
street3Seen SMALLINT,
street4Seen SMALLINT,
sdSeen SMALLINT,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
@ -348,19 +348,19 @@ class FpdbSQLQueries:
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
wonWhenSeenStreet1 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT NOT NULL,
wonWhenSeenStreet3 FLOAT NOT NULL,
wonWhenSeenStreet4 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT,
wonWhenSeenStreet3 FLOAT,
wonWhenSeenStreet4 FLOAT,
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,
street0_4BChance BOOLEAN,
street0_4BDone BOOLEAN,
other3BStreet0 BOOLEAN,
other4BStreet0 BOOLEAN,
street1Seen BOOLEAN NOT NULL,
street2Seen BOOLEAN NOT NULL,
@ -373,12 +373,12 @@ class FpdbSQLQueries:
street3Aggr BOOLEAN NOT NULL,
street4Aggr BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN,
otherRaisedStreet1 BOOLEAN NOT NULL,
otherRaisedStreet2 BOOLEAN NOT NULL,
otherRaisedStreet3 BOOLEAN NOT NULL,
otherRaisedStreet4 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN,
foldToOtherRaisedStreet1 BOOLEAN NOT NULL,
foldToOtherRaisedStreet2 BOOLEAN NOT NULL,
foldToOtherRaisedStreet3 BOOLEAN NOT NULL,
@ -456,19 +456,19 @@ class FpdbSQLQueries:
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,
wonWhenSeenStreet2 FLOAT,
wonWhenSeenStreet3 FLOAT,
wonWhenSeenStreet4 FLOAT,
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,
street0_4BChance BOOLEAN,
street0_4BDone BOOLEAN,
other3BStreet0 BOOLEAN,
other4BStreet0 BOOLEAN,
street1Seen BOOLEAN NOT NULL,
street2Seen BOOLEAN NOT NULL,
@ -481,12 +481,12 @@ class FpdbSQLQueries:
street3Aggr BOOLEAN NOT NULL,
street4Aggr BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN NOT NULL,
otherRaisedStreet0 BOOLEAN,
otherRaisedStreet1 BOOLEAN NOT NULL,
otherRaisedStreet2 BOOLEAN NOT NULL,
otherRaisedStreet3 BOOLEAN NOT NULL,
otherRaisedStreet4 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN NOT NULL,
foldToOtherRaisedStreet0 BOOLEAN,
foldToOtherRaisedStreet1 BOOLEAN NOT NULL,
foldToOtherRaisedStreet2 BOOLEAN NOT NULL,
foldToOtherRaisedStreet3 BOOLEAN NOT NULL,
@ -603,12 +603,22 @@ class FpdbSQLQueries:
activeSeats SMALLINT NOT NULL,
position CHAR(1),
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
HDs INT NOT NULL,
wonWhenSeenStreet1 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT,
wonWhenSeenStreet3 FLOAT,
wonWhenSeenStreet4 FLOAT,
wonAtSD FLOAT NOT NULL,
street0VPI INT NOT NULL,
street0Aggr INT NOT NULL,
street0_3B4BChance INT NOT NULL,
street0_3B4BDone INT NOT NULL,
street0_3BChance INT NOT NULL,
street0_3BDone INT NOT NULL,
street0_4BChance INT,
street0_4BDone INT,
other3BStreet0 INT,
other4BStreet0 INT,
street1Seen INT NOT NULL,
street2Seen INT NOT NULL,
@ -621,16 +631,16 @@ class FpdbSQLQueries:
street3Aggr INT NOT NULL,
street4Aggr INT NOT NULL,
otherRaisedStreet0 INT,
otherRaisedStreet1 INT NOT NULL,
otherRaisedStreet2 INT NOT NULL,
otherRaisedStreet3 INT NOT NULL,
otherRaisedStreet4 INT NOT NULL,
foldToOtherRaisedStreet0 INT,
foldToOtherRaisedStreet1 INT NOT NULL,
foldToOtherRaisedStreet2 INT NOT NULL,
foldToOtherRaisedStreet3 INT NOT NULL,
foldToOtherRaisedStreet4 INT NOT NULL,
wonWhenSeenStreet1 FLOAT NOT NULL,
wonAtSD FLOAT NOT NULL,
stealAttemptChance INT NOT NULL,
stealAttempted INT NOT NULL,
@ -676,12 +686,23 @@ class FpdbSQLQueries:
activeSeats SMALLINT,
position CHAR(1),
tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
HDs INT,
street0VPI INT,
wonWhenSeenStreet1 FLOAT NOT NULL,
wonWhenSeenStreet2 FLOAT,
wonWhenSeenStreet3 FLOAT,
wonWhenSeenStreet4 FLOAT,
wonAtSD FLOAT NOT NULL,
street0VPI INT NOT NULL,
street0Aggr INT,
street0_3B4BChance INT,
street0_3B4BDone INT,
street0_3BChance INT NOT NULL,
street0_3BDone INT NOT NULL,
street0_4BChance INT,
street0_4BDone INT,
other3BStreet0 INT,
other4BStreet0 INT,
street1Seen INT,
street2Seen INT,
street3Seen INT,
@ -691,16 +712,17 @@ class FpdbSQLQueries:
street2Aggr INT,
street3Aggr INT,
street4Aggr INT,
otherRaisedStreet0 INT,
otherRaisedStreet1 INT,
otherRaisedStreet2 INT,
otherRaisedStreet3 INT,
otherRaisedStreet4 INT,
foldToOtherRaisedStreet0 INT,
foldToOtherRaisedStreet1 INT,
foldToOtherRaisedStreet2 INT,
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
wonWhenSeenStreet1 FLOAT,
wonAtSD FLOAT,
stealAttemptChance INT,
stealAttempted INT,
@ -810,8 +832,8 @@ class FpdbSQLQueries:
,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))
,case when sum(cast(street0_3Bchance as integer)) = 0 then '0'
else 100.0*sum(cast(street0_3Bdone as integer))/sum(cast(street0_3Bchance 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))
@ -896,8 +918,8 @@ class FpdbSQLQueries:
,sum(HDs) AS n
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
,case when sum(street0_3b4bchance) = 0 then '0'
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
,case when sum(street0_3Bchance) = 0 then '0'
else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1)
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
@ -996,8 +1018,8 @@ class FpdbSQLQueries:
,sum(HDs) as n
,to_char(100.0*sum(street0VPI)/sum(HDs),'990D0') AS vpip
,to_char(100.0*sum(street0Aggr)/sum(HDs),'90D0') AS pfr
,case when sum(street0_3b4bchance) = 0 then '0'
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
,case when sum(street0_3Bchance) = 0 then '0'
else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0')
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
@ -1118,8 +1140,8 @@ class FpdbSQLQueries:
,sum(HDs) AS n
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
,case when sum(street0_3b4bchance) = 0 then '0'
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
,case when sum(street0_3Bchance) = 0 then '0'
else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1)
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
@ -1249,8 +1271,8 @@ class FpdbSQLQueries:
,sum(HDs) AS n
,to_char(round(100.0*sum(street0VPI)/sum(HDs)),'990D0') AS vpip
,to_char(round(100.0*sum(street0Aggr)/sum(HDs)),'90D0') AS pfr
,case when sum(street0_3b4bchance) = 0 then '0'
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
,case when sum(street0_3Bchance) = 0 then '0'
else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0')
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
@ -1449,7 +1471,7 @@ class FpdbSQLQueries:
, hp.winnings - SUM(ha.amount) as profit
from HandsPlayers hp
inner join Hands h ON h.id = hp.handId
left join HandsActions ha ON ha.handPlayerId = hp.id
left join HandsActions ha ON ha.handsPlayerId = hp.id
where hp.playerId in <player_test>
# use <gametype_test> here ?
and hp.tourneysPlayersId IS NULL
@ -1489,8 +1511,8 @@ class FpdbSQLQueries:
,wonAtSD
,street0VPI
,street0Aggr
,street0_3B4BChance
,street0_3B4BDone
,street0_3BChance
,street0_3BDone
,street1Seen
,street2Seen
,street3Seen
@ -1563,8 +1585,8 @@ class FpdbSQLQueries:
,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(street0_3BChance as integer))
,sum(CAST(street0_3BDone as integer))
,sum(CAST(street1Seen as integer))
,sum(CAST(street2Seen as integer))
,sum(CAST(street3Seen as integer))

View File

@ -76,7 +76,7 @@ class GuiTableViewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
tmp=("Name", "HDs", "VPIP", "PFR", "PF3B4B", "ST")
tmp=("Name", "HDs", "VPIP", "PFR", "PF3B", "ST")
tmp+=("FS", "FB")
@ -131,7 +131,7 @@ class GuiTableViewer (threading.Thread):
tmp.append(str(row[6]))#Hands
tmp.append(self.hudDivide(row[7],row[6])) #VPIP
tmp.append(self.hudDivide(row[8],row[6])) #PFR
tmp.append(self.hudDivide(row[10],row[9])+" ("+str(row[9])+")") #PF3B4B
tmp.append(self.hudDivide(row[10],row[9])+" ("+str(row[9])+")") #PF3B
tmp.append(self.hudDivide(row[31],row[30])+" ("+str(row[30])+")") #ST

View File

@ -172,72 +172,72 @@ class Sql:
"""
self.query['get_stats_from_hand'] = """
SELECT HudCache.playerId AS player_id,
HandsPlayers.seatNo AS seat,
Players.name AS screen_name,
sum(HDs) AS n,
sum(street0VPI) AS vpip,
sum(street0Aggr) AS pfr,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street1Seen) AS saw_f,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
sum(street3Seen) AS saw_3,
sum(street4Seen) AS saw_4,
sum(sawShowdown) AS sd,
sum(street1Aggr) AS aggr_1,
sum(street2Aggr) AS aggr_2,
sum(street3Aggr) AS aggr_3,
sum(street4Aggr) AS aggr_4,
sum(otherRaisedStreet1) AS was_raised_1,
sum(otherRaisedStreet2) AS was_raised_2,
sum(otherRaisedStreet3) AS was_raised_3,
sum(otherRaisedStreet4) AS was_raised_4,
sum(foldToOtherRaisedStreet1) AS f_freq_1,
sum(foldToOtherRaisedStreet2) AS f_freq_2,
sum(foldToOtherRaisedStreet3) AS f_freq_3,
sum(foldToOtherRaisedStreet4) AS f_freq_4,
sum(wonWhenSeenStreet1) AS w_w_s_1,
sum(wonAtSD) AS wmsd,
sum(stealAttemptChance) AS steal_opp,
sum(stealAttempted) AS steal,
sum(foldSbToStealChance) AS SBstolen,
sum(foldedSbToSteal) AS SBnotDef,
sum(foldBbToStealChance) AS BBstolen,
sum(foldedBbToSteal) AS BBnotDef,
sum(street1CBChance) AS CB_opp_1,
sum(street1CBDone) AS CB_1,
sum(street2CBChance) AS CB_opp_2,
sum(street2CBDone) AS CB_2,
sum(street3CBChance) AS CB_opp_3,
sum(street3CBDone) AS CB_3,
sum(street4CBChance) AS CB_opp_4,
sum(street4CBDone) AS CB_4,
sum(foldToStreet1CBChance) AS f_cb_opp_1,
sum(foldToStreet1CBDone) AS f_cb_1,
sum(foldToStreet2CBChance) AS f_cb_opp_2,
sum(foldToStreet2CBDone) AS f_cb_2,
sum(foldToStreet3CBChance) AS f_cb_opp_3,
sum(foldToStreet3CBDone) AS f_cb_3,
sum(foldToStreet4CBChance) AS f_cb_opp_4,
sum(foldToStreet4CBDone) AS f_cb_4,
sum(totalProfit) AS net,
sum(street1CheckCallRaiseChance) AS ccr_opp_1,
sum(street1CheckCallRaiseDone) AS ccr_1,
sum(street2CheckCallRaiseChance) AS ccr_opp_2,
sum(street2CheckCallRaiseDone) AS ccr_2,
sum(street3CheckCallRaiseChance) AS ccr_opp_3,
sum(street3CheckCallRaiseDone) AS ccr_3,
sum(street4CheckCallRaiseChance) AS ccr_opp_4,
sum(street4CheckCallRaiseDone) AS ccr_4
FROM Hands
INNER JOIN HandsPlayers ON (HandsPlayers.handId = %s)
INNER JOIN HudCache ON ( HudCache.PlayerId = HandsPlayers.PlayerId+0
AND HudCache.gametypeId+0 = Hands.gametypeId+0)
INNER JOIN Players ON (Players.id = HandsPlayers.PlayerId+0)
WHERE Hands.id = %s
GROUP BY HudCache.PlayerId, HandsPlayers.seatNo, Players.name
SELECT hc.playerId AS player_id,
hp.seatNo AS seat,
p.name AS screen_name,
sum(hc.HDs) AS n,
sum(hc.street0VPI) AS vpip,
sum(hc.street0Aggr) AS pfr,
sum(hc.street0_3BChance) AS TB_opp_0,
sum(hc.street0_3BDone) AS TB_0,
sum(hc.street1Seen) AS saw_f,
sum(hc.street1Seen) AS saw_1,
sum(hc.street2Seen) AS saw_2,
sum(hc.street3Seen) AS saw_3,
sum(hc.street4Seen) AS saw_4,
sum(hc.sawShowdown) AS sd,
sum(hc.street1Aggr) AS aggr_1,
sum(hc.street2Aggr) AS aggr_2,
sum(hc.street3Aggr) AS aggr_3,
sum(hc.street4Aggr) AS aggr_4,
sum(hc.otherRaisedStreet1) AS was_raised_1,
sum(hc.otherRaisedStreet2) AS was_raised_2,
sum(hc.otherRaisedStreet3) AS was_raised_3,
sum(hc.otherRaisedStreet4) AS was_raised_4,
sum(hc.foldToOtherRaisedStreet1) AS f_freq_1,
sum(hc.foldToOtherRaisedStreet2) AS f_freq_2,
sum(hc.foldToOtherRaisedStreet3) AS f_freq_3,
sum(hc.foldToOtherRaisedStreet4) AS f_freq_4,
sum(hc.wonWhenSeenStreet1) AS w_w_s_1,
sum(hc.wonAtSD) AS wmsd,
sum(hc.stealAttemptChance) AS steal_opp,
sum(hc.stealAttempted) AS steal,
sum(hc.foldSbToStealChance) AS SBstolen,
sum(hc.foldedSbToSteal) AS SBnotDef,
sum(hc.foldBbToStealChance) AS BBstolen,
sum(hc.foldedBbToSteal) AS BBnotDef,
sum(hc.street1CBChance) AS CB_opp_1,
sum(hc.street1CBDone) AS CB_1,
sum(hc.street2CBChance) AS CB_opp_2,
sum(hc.street2CBDone) AS CB_2,
sum(hc.street3CBChance) AS CB_opp_3,
sum(hc.street3CBDone) AS CB_3,
sum(hc.street4CBChance) AS CB_opp_4,
sum(hc.street4CBDone) AS CB_4,
sum(hc.foldToStreet1CBChance) AS f_cb_opp_1,
sum(hc.foldToStreet1CBDone) AS f_cb_1,
sum(hc.foldToStreet2CBChance) AS f_cb_opp_2,
sum(hc.foldToStreet2CBDone) AS f_cb_2,
sum(hc.foldToStreet3CBChance) AS f_cb_opp_3,
sum(hc.foldToStreet3CBDone) AS f_cb_3,
sum(hc.foldToStreet4CBChance) AS f_cb_opp_4,
sum(hc.foldToStreet4CBDone) AS f_cb_4,
sum(hc.totalProfit) AS net,
sum(hc.street1CheckCallRaiseChance) AS ccr_opp_1,
sum(hc.street1CheckCallRaiseDone) AS ccr_1,
sum(hc.street2CheckCallRaiseChance) AS ccr_opp_2,
sum(hc.street2CheckCallRaiseDone) AS ccr_2,
sum(hc.street3CheckCallRaiseChance) AS ccr_opp_3,
sum(hc.street3CheckCallRaiseDone) AS ccr_3,
sum(hc.street4CheckCallRaiseChance) AS ccr_opp_4,
sum(hc.street4CheckCallRaiseDone) AS ccr_4
FROM Hands h
INNER JOIN HandsPlayers hp ON (hp.handId = %s)
INNER JOIN HudCache hc ON ( hc.PlayerId = hp.PlayerId+0
AND hc.gametypeId+0 = h.gametypeId+0)
INNER JOIN Players p ON (p.id = hp.PlayerId+0)
WHERE h.id = %s
GROUP BY hc.PlayerId, hp.seatNo, p.name
"""
# same as above except stats are aggregated for all blind/limit levels
@ -246,8 +246,8 @@ class Sql:
sum(HDs) AS n,
sum(street0VPI) AS vpip,
sum(street0Aggr) AS pfr,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street0_3BChance) AS TB_opp_0,
sum(street0_3BDone) AS TB_0,
sum(street1Seen) AS saw_f,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
@ -377,7 +377,7 @@ class Sql:
FROM Players, HandsActions, HandsPlayers
WHERE HandsPlayers.handid = %s
AND HandsPlayers.playerid = Players.id
AND HandsActions.handPlayerId = HandsPlayers.id
AND HandsActions.handsPlayerId = HandsPlayers.id
ORDER BY street, actionno
"""
if __name__== "__main__":

View File

@ -54,7 +54,7 @@ indexes = [
, {'tab':'Gametypes', 'col':'siteId', 'drop':0}
, {'tab':'Hands', 'col':'gametypeId', 'drop':0} # mct 22/3/09
, {'tab':'Hands', 'col':'siteHandNo', 'drop':0}
, {'tab':'HandsActions', 'col':'handplayerId', 'drop':0}
, {'tab':'HandsActions', 'col':'handsPlayerId', 'drop':0}
, {'tab':'HandsPlayers', 'col':'handId', 'drop':1}
, {'tab':'HandsPlayers', 'col':'playerId', 'drop':1}
, {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0}
@ -78,7 +78,7 @@ foreignKeys = [
{'fktab':'Hands', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
, {'fktab':'HandsPlayers', 'fkcol':'handId', 'rtab':'Hands', 'rcol':'id', 'drop':1}
, {'fktab':'HandsPlayers', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':1}
, {'fktab':'HandsActions', 'fkcol':'handPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
, {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
, {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
, {'fktab':'HudCache', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':0}
, {'fktab':'HudCache', 'fkcol':'tourneyTypeId', 'rtab':'TourneyTypes', 'rcol':'id', 'drop':1}
@ -87,7 +87,7 @@ foreignKeys = [
{'fktab':'Hands', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
, {'fktab':'HandsPlayers', 'fkcol':'handId', 'rtab':'Hands', 'rcol':'id', 'drop':1}
, {'fktab':'HandsPlayers', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':1}
, {'fktab':'HandsActions', 'fkcol':'handPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
, {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
, {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
, {'fktab':'HudCache', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':0}
, {'fktab':'HudCache', 'fkcol':'tourneyTypeId', 'rtab':'TourneyTypes', 'rcol':'id', 'drop':1}
@ -1433,7 +1433,7 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac
# Add inserts into a list and let
inserts = inserts + [(handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])]
cursor.executemany("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", inserts)
cursor.executemany("INSERT INTO HandsActions (handsPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", inserts)
#end def storeActions
def store_board_cards(cursor, hands_id, board_values, board_suits):
@ -1482,7 +1482,7 @@ def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id,
INSERT INTO HandsPlayers
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo, totalProfit,
street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
otherRaisedStreet1, otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4,
@ -1503,7 +1503,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
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['street0_3BChance'][i], hudCache['street0_3BDone'][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],
@ -1534,7 +1534,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
(handId, playerId, startCash, position, activeSeats, tourneyTypeId,
card1Value, card1Suit, card2Value, card2Suit,
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo, totalProfit,
street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr,
otherRaisedStreet1, otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4,
@ -1556,7 +1556,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
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['street0_3BChance'][i], hudCache['street0_3BDone'][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],
@ -1679,8 +1679,8 @@ sure to also change the following storage method and table_viewer.prepare_data i
#setup subarrays of the result dictionary.
street0VPI=[]
street0Aggr=[]
street0_3B4BChance=[]
street0_3B4BDone=[]
street0_3BChance=[]
street0_3BDone=[]
street1Seen=[]
street2Seen=[]
street3Seen=[]
@ -1753,8 +1753,8 @@ sure to also change the following storage method and table_viewer.prepare_data i
#set default values
myStreet0VPI=False
myStreet0Aggr=False
myStreet0_3B4BChance=False
myStreet0_3B4BDone=False
myStreet0_3BChance=False
myStreet0_3BDone=False
myStreet1Seen=False
myStreet2Seen=False
myStreet3Seen=False
@ -1786,7 +1786,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
if currentAction == "bet" or currentAction == "call":
myStreet0VPI = True
#PF3B4BChance and PF3B4B
#PF3BChance and PF3B
pfFold=-1
pfRaise=-1
if firstPfRaiseByNo != -1:
@ -1797,9 +1797,9 @@ sure to also change the following storage method and table_viewer.prepare_data i
if actionType[1] == "fold" and pfFold == -1:
pfFold = i
if pfFold == -1 or pfFold > firstPfRaiseByNo:
myStreet0_3B4BChance = True
myStreet0_3BChance = True
if pfRaise > firstPfRaiseByNo:
myStreet0_3B4BDone = True
myStreet0_3BDone = True
#steal calculations
if base=="hold":
@ -1944,8 +1944,8 @@ sure to also change the following storage method and table_viewer.prepare_data i
#add each value to the appropriate array
street0VPI.append(myStreet0VPI)
street0Aggr.append(myStreet0Aggr)
street0_3B4BChance.append(myStreet0_3B4BChance)
street0_3B4BDone.append(myStreet0_3B4BDone)
street0_3BChance.append(myStreet0_3BChance)
street0_3BDone.append(myStreet0_3BDone)
street1Seen.append(myStreet1Seen)
street2Seen.append(myStreet2Seen)
street3Seen.append(myStreet3Seen)
@ -1993,8 +1993,8 @@ sure to also change the following storage method and table_viewer.prepare_data i
#add each array to the to-be-returned dictionary
result={'street0VPI':street0VPI}
result['street0Aggr']=street0Aggr
result['street0_3B4BChance']=street0_3B4BChance
result['street0_3B4BDone']=street0_3B4BDone
result['street0_3BChance']=street0_3BChance
result['street0_3BDone']=street0_3BDone
result['street1Seen']=street1Seen
result['street2Seen']=street2Seen
result['street3Seen']=street3Seen
@ -2305,8 +2305,8 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
row[6]+=1 #HDs
if hudImportData['street0VPI'][player]: row[7]+=1
if hudImportData['street0Aggr'][player]: row[8]+=1
if hudImportData['street0_3B4BChance'][player]: row[9]+=1
if hudImportData['street0_3B4BDone'][player]: row[10]+=1
if hudImportData['street0_3BChance'][player]: row[9]+=1
if hudImportData['street0_3BDone'][player]: row[10]+=1
if hudImportData['street1Seen'][player]: row[11]+=1
if hudImportData['street2Seen'][player]: row[12]+=1
if hudImportData['street3Seen'][player]: row[13]+=1
@ -2369,7 +2369,7 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudCache
(gametypeId, playerId, activeSeats, position, tourneyTypeId,
HDs, street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
HDs, street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr, otherRaisedStreet1,
otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4, foldToOtherRaisedStreet1, foldToOtherRaisedStreet2,
@ -2395,7 +2395,7 @@ VALUES (%s, %s, %s, %s, %s,
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudCache
SET HDs=%s, street0VPI=%s, street0Aggr=%s, street0_3B4BChance=%s, street0_3B4BDone=%s,
SET HDs=%s, street0VPI=%s, street0Aggr=%s, street0_3BChance=%s, street0_3BDone=%s,
street1Seen=%s, street2Seen=%s, street3Seen=%s, street4Seen=%s, sawShowdown=%s,
street1Aggr=%s, street2Aggr=%s, street3Aggr=%s, street4Aggr=%s, otherRaisedStreet1=%s,
otherRaisedStreet2=%s, otherRaisedStreet3=%s, otherRaisedStreet4=%s, foldToOtherRaisedStreet1=%s, foldToOtherRaisedStreet2=%s,
@ -2444,8 +2444,8 @@ def storeHudCache2(backend, cursor, base, category, gametypeId, playerIds, hudIm
row[6]+=1 #HDs
if hudImportData['street0VPI'][player]: row[7]+=1
if hudImportData['street0Aggr'][player]: row[8]+=1
if hudImportData['street0_3B4BChance'][player]: row[9]+=1
if hudImportData['street0_3B4BDone'][player]: row[10]+=1
if hudImportData['street0_3BChance'][player]: row[9]+=1
if hudImportData['street0_3BDone'][player]: row[10]+=1
if hudImportData['street1Seen'][player]: row[11]+=1
if hudImportData['street2Seen'][player]: row[12]+=1
if hudImportData['street3Seen'][player]: row[13]+=1
@ -2507,7 +2507,7 @@ def storeHudCache2(backend, cursor, base, category, gametypeId, playerIds, hudIm
# Try to do the update first:
num = cursor.execute("""UPDATE HudCache
SET HDs=HDs+%s, street0VPI=street0VPI+%s, street0Aggr=street0Aggr+%s,
street0_3B4BChance=street0_3B4BChance+%s, street0_3B4BDone=street0_3B4BDone+%s,
street0_3BChance=street0_3BChance+%s, street0_3BDone=street0_3BDone+%s,
street1Seen=street1Seen+%s, street2Seen=street2Seen+%s, street3Seen=street3Seen+%s,
street4Seen=street4Seen+%s, sawShowdown=sawShowdown+%s,
street1Aggr=street1Aggr+%s, street2Aggr=street2Aggr+%s, street3Aggr=street3Aggr+%s,
@ -2556,7 +2556,7 @@ AND tourneyTypeId+0=%s""", (row[6], row[7], row[8], row[9], row[10],
#print "playerid before insert:",row[2]," num = ", num
cursor.execute("""INSERT INTO HudCache
(gametypeId, playerId, activeSeats, position, tourneyTypeId,
HDs, street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone,
HDs, street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr, otherRaisedStreet1,
otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4, foldToOtherRaisedStreet1, foldToOtherRaisedStreet2,