Street(x)Bet and street(x)Call and Street(x)Raises

Now updates in hud chache also
This commit is contained in:
Gerko de Roo 2010-06-11 20:33:08 +02:00
parent db6f7989a9
commit d9f6967c1c
3 changed files with 108 additions and 26 deletions

View File

@ -1633,7 +1633,12 @@ class Database:
pdata[p]['street3CheckCallRaiseChance'],
pdata[p]['street3CheckCallRaiseDone'],
pdata[p]['street4CheckCallRaiseChance'],
pdata[p]['street4CheckCallRaiseDone']
pdata[p]['street4CheckCallRaiseDone'],
pdata[p]['street0Raises'],
pdata[p]['street1Raises'],
pdata[p]['street2Raises'],
pdata[p]['street3Raises'],
pdata[p]['street4Raises']
) )
q = self.sql.query['store_hands_players']
@ -1662,7 +1667,7 @@ class Database:
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
inserts = []
for p in pdata:
line = [0]*71
line = [0]*76
line[0] = 1 # HDs
if pdata[p]['street0VPI']: line[1] = 1
@ -1729,14 +1734,19 @@ class Database:
if pdata[p]['street2Bets']: line[62] = 1
if pdata[p]['street3Bets']: line[63] = 1
if pdata[p]['street4Bets']: line[64] = 1
if pdata[p]['street0Raises']: line[65] = 1
if pdata[p]['street1Raises']: line[66] = 1
if pdata[p]['street2Raises']: line[67] = 1
if pdata[p]['street3Raises']: line[68] = 1
if pdata[p]['street4Raises']: line[69] = 1
line[65] = gid # gametypeId
line[66] = pids[p] # playerId
line[67] = len(pids) # activeSeats
line[70] = gid # gametypeId
line[71] = pids[p] # playerId
line[72] = len(pids) # activeSeats
pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' }
line[68] = pos[pdata[p]['position']]
line[69] = pdata[p]['tourneyTypeId']
line[70] = styleKey # styleKey
line[73] = pos[pdata[p]['position']]
line[74] = pdata[p]['tourneyTypeId']
line[75] = styleKey # styleKey
inserts.append(line)

View File

@ -1346,7 +1346,12 @@ class Sql:
sum(hc.street1Bets) AS bet_1,
sum(hc.street2Bets) AS bet_2,
sum(hc.street3Bets) AS bet_3,
sum(hc.street4Bets) AS bet_4
sum(hc.street4Bets) AS bet_4,
sum(hc.street0Raises) AS raise_0,
sum(hc.street1Raises) AS raise_1,
sum(hc.street2Raises) AS raise_2,
sum(hc.street3Raises) AS raise_3,
sum(hc.street4Raises) AS raise_4
FROM Hands h
INNER JOIN HandsPlayers hp ON (hp.handId = h.id)
INNER JOIN HudCache hc ON ( hc.PlayerId = hp.PlayerId+0
@ -1440,7 +1445,12 @@ class Sql:
sum(hc.street1Bets) AS bet_1,
sum(hc.street2Bets) AS bet_2,
sum(hc.street3Bets) AS bet_3,
sum(hc.street4Bets) AS bet_4
sum(hc.street4Bets) AS bet_4,
sum(hc.street0Raises) AS raise_0,
sum(hc.street1Raises) AS raise_1,
sum(hc.street2Raises) AS raise_2,
sum(hc.street3Raises) AS raise_3,
sum(hc.street4Raises) AS raise_4
FROM Hands h
INNER JOIN HandsPlayers hp ON (hp.handId = h.id)
INNER JOIN HudCache hc ON (hc.playerId = hp.playerId)
@ -1551,7 +1561,22 @@ class Sql:
cast(hp2.street3CheckCallRaiseChance as <signed>integer) AS ccr_opp_3,
cast(hp2.street3CheckCallRaiseDone as <signed>integer) AS ccr_3,
cast(hp2.street4CheckCallRaiseChance as <signed>integer) AS ccr_opp_4,
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4,
cast(hp2.street0Calls as <signed>integer) AS call_0,
cast(hp2.street1Calls as <signed>integer) AS call_1,
cast(hp2.street2Calls as <signed>integer) AS call_2,
cast(hp2.street3Calls as <signed>integer) AS call_3,
cast(hp2.street4Calls as <signed>integer) AS call_4,
cast(hp2.street0Bets as <signed>integer) AS bet_0,
cast(hp2.street1Bets as <signed>integer) AS bet_1,
cast(hp2.street2Bets as <signed>integer) AS bet_2,
cast(hp2.street3Bets as <signed>integer) AS bet_3,
cast(hp2.street4Bets as <signed>integer) AS bet_4,
cast(hp2.street0Raises as <signed>integer) AS raise_0,
cast(hp2.street1Raises as <signed>integer) AS raise_1,
cast(hp2.street2Raises as <signed>integer) AS raise_2,
cast(hp2.street3Raises as <signed>integer) AS raise_3,
cast(hp2.street4Raises as <signed>integer) AS raise_4
FROM
Hands h
INNER JOIN Hands h2 ON (h2.id > %s AND h2.tableName = h.tableName)
@ -1638,7 +1663,22 @@ class Sql:
cast(hp2.street3CheckCallRaiseChance as <signed>integer) AS ccr_opp_3,
cast(hp2.street3CheckCallRaiseDone as <signed>integer) AS ccr_3,
cast(hp2.street4CheckCallRaiseChance as <signed>integer) AS ccr_opp_4,
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4,
cast(hp2.street0Calls as <signed>integer) AS call_0,
cast(hp2.street1Calls as <signed>integer) AS call_1,
cast(hp2.street2Calls as <signed>integer) AS call_2,
cast(hp2.street3Calls as <signed>integer) AS call_3,
cast(hp2.street4Calls as <signed>integer) AS call_4,
cast(hp2.street0Bets as <signed>integer) AS bet_0,
cast(hp2.street1Bets as <signed>integer) AS bet_1,
cast(hp2.street2Bets as <signed>integer) AS bet_2,
cast(hp2.street3Bets as <signed>integer) AS bet_3,
cast(hp2.street4Bets as <signed>integer) AS bet_4,
cast(hp2.street0Raises as <signed>integer) AS raise_0,
cast(hp2.street1Raises as <signed>integer) AS raise_1,
cast(hp2.street2Raises as <signed>integer) AS raise_2,
cast(hp2.street3Raises as <signed>integer) AS raise_3,
cast(hp2.street4Raises as <signed>integer) AS raise_4
FROM Hands h /* this hand */
INNER JOIN Hands h2 ON ( h2.id > %s /* other hands */
AND h2.tableName = h.tableName)
@ -1726,7 +1766,22 @@ class Sql:
cast(hp2.street3CheckCallRaiseChance as <signed>integer) AS ccr_opp_3,
cast(hp2.street3CheckCallRaiseDone as <signed>integer) AS ccr_3,
cast(hp2.street4CheckCallRaiseChance as <signed>integer) AS ccr_opp_4,
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4
cast(hp2.street4CheckCallRaiseDone as <signed>integer) AS ccr_4,
cast(hp2.street0Calls as <signed>integer) AS call_0,
cast(hp2.street1Calls as <signed>integer) AS call_1,
cast(hp2.street2Calls as <signed>integer) AS call_2,
cast(hp2.street3Calls as <signed>integer) AS call_3,
cast(hp2.street4Calls as <signed>integer) AS call_4,
cast(hp2.street0Bets as <signed>integer) AS bet_0,
cast(hp2.street1Bets as <signed>integer) AS bet_1,
cast(hp2.street2Bets as <signed>integer) AS bet_2,
cast(hp2.street3Bets as <signed>integer) AS bet_3,
cast(hp2.street4Bets as <signed>integer) AS bet_4,
cast(hp2.street0Raises as <signed>integer) AS raise_0,
cast(hp2.street1Raises as <signed>integer) AS raise_1,
cast(hp2.street2Raises as <signed>integer) AS raise_2,
cast(hp2.street3Raises as <signed>integer) AS raise_3,
cast(hp2.street4Raises as <signed>integer) AS raise_4
FROM Hands h /* this hand */
INNER JOIN Hands h2 ON ( h2.id > %s /* other hands */
AND h2.tableName = h.tableName)
@ -3295,7 +3350,12 @@ class Sql:
street1Bets,
street2Bets,
street3Bets,
street4Bets)
street4Bets,
street0Raises,
street1Raises,
street2Raises,
street3Raises,
street4Raises)
VALUES (%s, %s, %s, %s, %s,
%s, %s, %s, %s, %s,
%s, %s, %s, %s, %s,
@ -3310,6 +3370,7 @@ class Sql:
%s, %s, %s, %s, %s,
%s, %s, %s, %s, %s,
%s, %s, %s, %s, %s,
%s, %s, %s, %s, %s,
%s)"""
self.query['update_hudcache'] = """
@ -3378,7 +3439,12 @@ class Sql:
street1Bets=street1Bets+%s,
street2Bets=street2Bets+%s,
street3Bets=street3Bets+%s,
street4Bets=street4Bets+%s
street4Bets=street4Bets+%s,
street0Raises=street0Raises+%s,
street1Raises=street1Raises+%s,
street2Raises=street2Raises+%s,
street3Raises=street3Raises+%s,
street4Raises=street4Raises+%s
WHERE gametypeId+0=%s
AND playerId=%s
AND activeSeats=%s
@ -3704,7 +3770,12 @@ class Sql:
street3CheckCallRaiseChance,
street3CheckCallRaiseDone,
street4CheckCallRaiseChance,
street4CheckCallRaiseDone
street4CheckCallRaiseDone,
street0Raises,
street1Raises,
street2Raises,
street3Raises,
street4Raises
)
VALUES (
%s, %s, %s, %s, %s,
@ -3722,6 +3793,7 @@ class Sql:
%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
)"""

View File

@ -540,23 +540,23 @@ def agg_fact(stat_dict, player):
""" Times called post flop is not availlable, streets seen used """
stat = 0.0
try:
bet_raise = stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4']
post_call = stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4']
bet_raise = stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4']
post_call = stat_dict[player]['call_1'] + stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4']
stat = float (bet_raise) / float(post_call)
return (stat,
'%2.1f' % (stat) ,
'afa=%2.1f' % (stat) ,
'agg_fa=%2.1f' % (stat) ,
'%2.2f' % (stat) ,
'afa=%2.2f' % (stat) ,
'agg_fa=%2.2f' % (stat) ,
'(%d/%d)' % (bet_raise, post_call),
'Aggression Factor'
)
except:
return (stat,
'%2.1f' % (0) ,
'afa=%2.1f' % (0) ,
'agg_fa=%2.1f' % (0),
'%2.2f' % (0) ,
'afa=%2.2f' % (0) ,
'agg_fa=%2.2f' % (0),
'(%d/%d)' % (0, 0),
'Aggression Factor'
)