Merge branch 'master' of git://git.assembla.com/fpdb-sql.git
This commit is contained in:
commit
8c46d3bde5
|
@ -195,25 +195,39 @@ class DerivedStats():
|
||||||
#
|
#
|
||||||
#This function is going to get it wrong when there in situations where there
|
#This function is going to get it wrong when there in situations where there
|
||||||
# is no small blind. I can live with that.
|
# is no small blind. I can live with that.
|
||||||
positions = [7, 6, 5, 4, 3, 2, 1, 0, 'S', 'B']
|
|
||||||
actions = hand.actions[hand.holeStreets[0]]
|
actions = hand.actions[hand.holeStreets[0]]
|
||||||
|
# Note: pfbao list may not include big blind if all others folded
|
||||||
players = self.pfbao(actions)
|
players = self.pfbao(actions)
|
||||||
|
|
||||||
|
if hand.gametype['base'] == 'stud':
|
||||||
|
positions = [7, 6, 5, 4, 3, 2, 1, 0, 'S', 'B']
|
||||||
seats = len(players)
|
seats = len(players)
|
||||||
map = []
|
map = []
|
||||||
if hand.gametype['base'] == 'stud':
|
|
||||||
# Could posibly change this to be either -2 or -1 depending if they complete or bring-in
|
# Could posibly change this to be either -2 or -1 depending if they complete or bring-in
|
||||||
# First player to act is -1, last player is 0 for 6 players it should look like:
|
# First player to act is -1, last player is 0 for 6 players it should look like:
|
||||||
# ['S', 4, 3, 2, 1, 0]
|
# ['S', 4, 3, 2, 1, 0]
|
||||||
map = positions[-seats-1:-1] # Copy required positions from postions array anding in -1
|
map = positions[-seats-1:-1] # Copy required positions from postions array anding in -1
|
||||||
map = map[-1:] + map[0:-1] # and move the -1 to the start of that array
|
map = map[-1:] + map[0:-1] # and move the -1 to the start of that array
|
||||||
else:
|
|
||||||
# For 6 players is should look like:
|
|
||||||
# [3, 2, 1, 0, 'S', 'B']
|
|
||||||
map = positions[-seats:] # Copy required positions from array ending in -2
|
|
||||||
|
|
||||||
for i, player in enumerate(players):
|
for i, player in enumerate(players):
|
||||||
#print "player %s in posn %s" % (player, str(map[i]))
|
#print "player %s in posn %s" % (player, str(map[i]))
|
||||||
self.handsplayers[player]['position'] = map[i]
|
self.handsplayers[player]['position'] = map[i]
|
||||||
|
else:
|
||||||
|
# set blinds first, then others from pfbao list, avoids problem if bb
|
||||||
|
# is missing from pfbao list or if there is no small blind
|
||||||
|
bb = [x[0] for x in hand.actions[hand.actionStreets[0]] if x[2] == 'big blind']
|
||||||
|
sb = [x[0] for x in hand.actions[hand.actionStreets[0]] if x[2] == 'small blind']
|
||||||
|
# if there are > 1 sb or bb only the first is used!
|
||||||
|
if bb:
|
||||||
|
self.handsplayers[bb[0]]['position'] = 'B'
|
||||||
|
if bb[0] in players: players.remove(bb[0])
|
||||||
|
if sb:
|
||||||
|
self.handsplayers[sb[0]]['position'] = 'S'
|
||||||
|
if sb[0] in players: players.remove(sb[0])
|
||||||
|
|
||||||
|
#print "bb =", bb, "sb =", sb, "players =", players
|
||||||
|
for i,player in enumerate(reversed(players)):
|
||||||
|
self.handsplayers[player]['position'] = i
|
||||||
|
|
||||||
def assembleHudCache(self, hand):
|
def assembleHudCache(self, hand):
|
||||||
# No real work to be done - HandsPlayers data already contains the correct info
|
# No real work to be done - HandsPlayers data already contains the correct info
|
||||||
|
@ -240,6 +254,7 @@ class DerivedStats():
|
||||||
# The number of unique players in the list per street gives the value for playersAtStreetXXX
|
# The number of unique players in the list per street gives the value for playersAtStreetXXX
|
||||||
|
|
||||||
# FIXME?? - This isn't couting people that are all in - at least showdown needs to reflect this
|
# FIXME?? - This isn't couting people that are all in - at least showdown needs to reflect this
|
||||||
|
# ... new code below hopefully fixes this
|
||||||
|
|
||||||
self.hands['playersAtStreet1'] = 0
|
self.hands['playersAtStreet1'] = 0
|
||||||
self.hands['playersAtStreet2'] = 0
|
self.hands['playersAtStreet2'] = 0
|
||||||
|
@ -247,23 +262,31 @@ class DerivedStats():
|
||||||
self.hands['playersAtStreet4'] = 0
|
self.hands['playersAtStreet4'] = 0
|
||||||
self.hands['playersAtShowdown'] = 0
|
self.hands['playersAtShowdown'] = 0
|
||||||
|
|
||||||
alliners = set()
|
# alliners = set()
|
||||||
for (i, street) in enumerate(hand.actionStreets[2:]):
|
# for (i, street) in enumerate(hand.actionStreets[2:]):
|
||||||
actors = set()
|
# actors = set()
|
||||||
for action in hand.actions[street]:
|
# for action in hand.actions[street]:
|
||||||
if len(action) > 2 and action[-1]: # allin
|
# if len(action) > 2 and action[-1]: # allin
|
||||||
alliners.add(action[0])
|
# alliners.add(action[0])
|
||||||
actors.add(action[0])
|
# actors.add(action[0])
|
||||||
if len(actors)==0 and len(alliners)<2:
|
# if len(actors)==0 and len(alliners)<2:
|
||||||
alliners = set()
|
# alliners = set()
|
||||||
self.hands['playersAtStreet%d' % (i+1)] = len(set.union(alliners, actors))
|
# self.hands['playersAtStreet%d' % (i+1)] = len(set.union(alliners, actors))
|
||||||
|
#
|
||||||
|
# actions = hand.actions[hand.actionStreets[-1]]
|
||||||
|
# print "p_actions:", self.pfba(actions), "p_folds:", self.pfba(actions, l=('folds',)), "alliners:", alliners
|
||||||
|
# pas = set.union(self.pfba(actions) - self.pfba(actions, l=('folds',)), alliners)
|
||||||
|
|
||||||
actions = hand.actions[hand.actionStreets[-1]]
|
p_in = set(x[1] for x in hand.players)
|
||||||
pas = set.union(self.pfba(actions) - self.pfba(actions, l=('folds',)), alliners)
|
for (i, street) in enumerate(hand.actionStreets):
|
||||||
self.hands['playersAtShowdown'] = len(pas)
|
actions = hand.actions[street]
|
||||||
|
p_in = p_in - self.pfba(actions, l=('folds',))
|
||||||
|
self.hands['playersAtStreet%d' % (i-1)] = len(p_in)
|
||||||
|
|
||||||
|
self.hands['playersAtShowdown'] = len(p_in)
|
||||||
|
|
||||||
if self.hands['playersAtShowdown'] > 1:
|
if self.hands['playersAtShowdown'] > 1:
|
||||||
for player in pas:
|
for player in p_in:
|
||||||
self.handsplayers[player]['sawShowdown'] = True
|
self.handsplayers[player]['sawShowdown'] = True
|
||||||
|
|
||||||
def streetXRaises(self, hand):
|
def streetXRaises(self, hand):
|
||||||
|
@ -282,6 +305,7 @@ class DerivedStats():
|
||||||
"""Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|)
|
"""Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|)
|
||||||
|
|
||||||
Steal attempt - open raise on positions 1 0 S - i.e. MP3, CO, BU, SB
|
Steal attempt - open raise on positions 1 0 S - i.e. MP3, CO, BU, SB
|
||||||
|
(note: I don't think PT2 counts SB steals in HU hands, maybe we shouldn't?)
|
||||||
Fold to steal - folding blind after steal attemp wo any other callers or raisers
|
Fold to steal - folding blind after steal attemp wo any other callers or raisers
|
||||||
"""
|
"""
|
||||||
steal_attempt = False
|
steal_attempt = False
|
||||||
|
|
|
@ -211,6 +211,9 @@ class Filters(threading.Thread):
|
||||||
self.Button2.connect("clicked", self.callback['button2'], "clicked")
|
self.Button2.connect("clicked", self.callback['button2'], "clicked")
|
||||||
self.Button2.set_sensitive(True)
|
self.Button2.set_sensitive(True)
|
||||||
|
|
||||||
|
# make sure any locks on db are released:
|
||||||
|
self.db.rollback()
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
return self.mainVBox
|
return self.mainVBox
|
||||||
|
|
|
@ -81,7 +81,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
self.filters.registerButton1Name("_Filters")
|
self.filters.registerButton1Name("_Filters")
|
||||||
self.filters.registerButton1Callback(self.showDetailFilter)
|
self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
self.filters.registerButton2Name("_Refresh")
|
self.filters.registerButton2Name("_Refresh Stats")
|
||||||
self.filters.registerButton2Callback(self.refreshStats)
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
# ToDo: store in config
|
# ToDo: store in config
|
||||||
|
@ -520,7 +520,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
blindtest = str(tuple(nolims))
|
blindtest = str(tuple(nolims))
|
||||||
blindtest = blindtest.replace("L", "")
|
blindtest = blindtest.replace("L", "")
|
||||||
blindtest = blindtest.replace(",)",")")
|
blindtest = blindtest.replace(",)",")")
|
||||||
bbtest = bbtest + blindtest + ' ) )'
|
bbtest = bbtest + blindtest + ' ) ) )'
|
||||||
else:
|
else:
|
||||||
bbtest = bbtest + '(-1) ) )'
|
bbtest = bbtest + '(-1) ) )'
|
||||||
if type == 'ring':
|
if type == 'ring':
|
||||||
|
@ -539,7 +539,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
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>", "-1")
|
query = query.replace("<hgameTypeId>", "p.name")
|
||||||
else:
|
else:
|
||||||
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user