tidy up aggregation code, NOTE: renamed some aggregation config to try and make meaning clearer, updated aggregation description in .example
This commit is contained in:
parent
289922e43a
commit
04c09af7b2
|
@ -361,16 +361,16 @@ class HudUI:
|
|||
self.node = node
|
||||
self.label = node.getAttribute('label')
|
||||
#
|
||||
self.hud_style = node.getAttribute('stat_range')
|
||||
self.hud_days = node.getAttribute('stat_days')
|
||||
self.aggregate_ring = string_to_bool(node.getAttribute('aggregate_ring_game_stats'))
|
||||
self.aggregate_tour = string_to_bool(node.getAttribute('aggregate_tourney_stats'))
|
||||
self.hud_style = node.getAttribute('stat_aggregation_range')
|
||||
self.hud_days = node.getAttribute('aggregation_days')
|
||||
self.agg_bb_mult = node.getAttribute('aggregation_level_multiplier')
|
||||
#
|
||||
self.h_hud_style = node.getAttribute('hero_stat_range')
|
||||
self.h_hud_days = node.getAttribute('hero_stat_days')
|
||||
self.h_aggregate_ring = string_to_bool(node.getAttribute('aggregate_hero_ring_game_stats'))
|
||||
self.h_aggregate_tour = string_to_bool(node.getAttribute('aggregate_hero_tourney_stats'))
|
||||
self.h_hud_style = node.getAttribute('hero_stat_aggregation_range')
|
||||
self.h_hud_days = node.getAttribute('hero_aggregation_days')
|
||||
self.h_agg_bb_mult = node.getAttribute('hero_aggregation_level_multiplier')
|
||||
|
||||
|
||||
|
|
|
@ -432,16 +432,14 @@ class Database:
|
|||
print "*** Database Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
|
||||
def get_stats_from_hand( self, hand, type # type is "ring" or "tour"
|
||||
, hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'hud_days':30, 'agg_bb_mult':100
|
||||
,'h_aggregate_tour':False, 'h_aggregate_ring':False, 'h_hud_style':'S', 'h_hud_days':30, 'h_agg_bb_mult':100}
|
||||
, hud_params = {'hud_style':'A', 'agg_bb_mult':1000
|
||||
,'h_hud_style':'S', 'h_agg_bb_mult':1000}
|
||||
, hero_id = -1
|
||||
):
|
||||
aggregate = hud_params['aggregate_tour'] if type == "tour" else hud_params['aggregate_ring']
|
||||
hud_style = hud_params['hud_style']
|
||||
agg_bb_mult = hud_params['agg_bb_mult'] if aggregate else 1
|
||||
h_aggregate = hud_params['h_aggregate_tour'] if type == "tour" else hud_params['h_aggregate_ring']
|
||||
agg_bb_mult = hud_params['agg_bb_mult']
|
||||
h_hud_style = hud_params['h_hud_style']
|
||||
h_agg_bb_mult = hud_params['h_agg_bb_mult'] if h_aggregate else 1
|
||||
h_agg_bb_mult = hud_params['h_agg_bb_mult']
|
||||
stat_dict = {}
|
||||
|
||||
if hud_style == 'S' or h_hud_style == 'S':
|
||||
|
@ -468,13 +466,8 @@ class Database:
|
|||
#elif h_hud_style == 'H':
|
||||
# h_stylekey = date_nhands_ago needs array by player here ...
|
||||
|
||||
#if aggregate: always use aggregate query now: use agg_bb_mult of 1 for no aggregation:
|
||||
query = 'get_stats_from_hand_aggregated'
|
||||
subs = (hand, hero_id, stylekey, agg_bb_mult, agg_bb_mult, hero_id, h_stylekey, h_agg_bb_mult, h_agg_bb_mult)
|
||||
#print "agg query subs:", subs
|
||||
#else:
|
||||
# query = 'get_stats_from_hand'
|
||||
# subs = (hand, stylekey)
|
||||
|
||||
#print "get stats: hud style =", hud_style, "query =", query, "subs =", subs
|
||||
c = self.connection.cursor()
|
||||
|
|
|
@ -4,91 +4,95 @@
|
|||
|
||||
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
|
||||
|
||||
<!-- These values need some explaining
|
||||
<!-- These values determine what stats are displayed in the HUD
|
||||
|
||||
The following values define how opponents' stats are done, the first 2 determine
|
||||
the time period stats are displayed for, the next 3 determine what blind levels
|
||||
are included (i.e. aggregated):
|
||||
|
||||
stat_range :
|
||||
- A/S/T
|
||||
- if set to A, includes stats from all time
|
||||
- if set to S, includes stats from current session
|
||||
- if set to T, includes stats from last N days; set value in stat_days
|
||||
- defaults to A
|
||||
|
||||
stat_days :
|
||||
- a numeric value
|
||||
- only used if stat_range is set to 'T', this value tells how many days are
|
||||
included in the stat calculation
|
||||
- defaults to 90
|
||||
- value not used by default as it depends on stat_range setting
|
||||
|
||||
aggregate_ring_game_stats :
|
||||
- True/False
|
||||
- if set to True, includes data from other blind levels
|
||||
- if set to True, opponents stats include other blind levels during ring games
|
||||
- defaults to False
|
||||
|
||||
aggregate_tourney_stats :
|
||||
- True/False
|
||||
- if set to True, includes data from other blind levels
|
||||
- if set to True, opponents stats include other blind levels during tourneys
|
||||
- defaults to True
|
||||
|
||||
stat_aggregation_range :
|
||||
- A/S/T
|
||||
- if set to A, includes stats from all time
|
||||
- if set to S, includes stats from current sessions
|
||||
- if set to T, includes stats from last N days; set value in hud_days
|
||||
- defaults to A
|
||||
|
||||
aggregation_days :
|
||||
- a numeric value
|
||||
- if hud_style is set to 'T', this value tells how many days are
|
||||
included in the stat calculation
|
||||
- defaults to 90
|
||||
- value not used by default, as depends on hud_style setting
|
||||
|
||||
aggregation_level_multiplier :
|
||||
- float value
|
||||
- defines how many blind levels are used for aggregation
|
||||
- the logic is weird, at best
|
||||
- if value is 100, almost all levels are included
|
||||
- if value is 2.1, levels from half to double the current blind
|
||||
level are included
|
||||
- if value it 1, no aggregation is performed
|
||||
- defaults to 1
|
||||
- defines how many blind levels are included in stats displayed in HUD
|
||||
- if value is M, stats for blind levels are combined if the higher level
|
||||
is less than or equal to M times the lower blind level
|
||||
- defaults to 3, meaning blind levels from 1/3 of the current level to 3
|
||||
times the current level are included in the stats displayed in the HUD
|
||||
- e.g. if current big blind is 50, stats for blind levels from big blind
|
||||
of 16.7 (50 divided by 3) to big blind of 150 (50 times 3) are included
|
||||
|
||||
|
||||
The following values define how hero's stats are done
|
||||
The following values define how hero's stats are done, the first 2 determine
|
||||
the time period stats are displayed for, the next 3 determine what blind levels
|
||||
are included (i.e. aggregated):
|
||||
|
||||
hero_stat_range :
|
||||
- A/S/T
|
||||
- if set to A, includes stats from all time
|
||||
- if set to S, includes stats from current session
|
||||
- if set to T, includes stats from last N days; set value in hero_stat_days
|
||||
- defaults to S
|
||||
|
||||
hero_stat_days :
|
||||
- a numeric value
|
||||
- if hero_stat_range is set to 'T', this value tells how many days are
|
||||
included in the stat calculation
|
||||
- defaults to 30
|
||||
- value not used by default as it depends on hero_stat_range setting
|
||||
|
||||
aggregate_hero_ring_game_stats :
|
||||
- True/False
|
||||
- if set to True, hero's data is calculated over multiple blind levels
|
||||
- if set to True, hero's stats are calculated over multiple blind levels
|
||||
- defaults to False
|
||||
|
||||
aggregate_hero_tourney_stats :
|
||||
- True/False
|
||||
- if set to True, hero's data is calculated over multiple blind levels
|
||||
- if set to True, hero's stats are calculated over multiple blind levels
|
||||
- defaults to False
|
||||
|
||||
hero_stat_aggregation_range :
|
||||
- A/S/T
|
||||
- if set to A, includes stats from all time
|
||||
- if set to S, includes stats from current sessions
|
||||
- if set to T, includes stats from last N days; set value in hud_days
|
||||
- defaults to S
|
||||
|
||||
hero_aggregation_days :
|
||||
- a numeric value
|
||||
- if hero_stat_aggregation_range is set to 'T', this value tells
|
||||
how many days are included in the stat calculation
|
||||
- defaults to 30
|
||||
- value not used by default, as depends on hud_style setting
|
||||
|
||||
hero_aggregation_level_multiplier :
|
||||
- float value
|
||||
- defines how many blind levels are used for aggregation
|
||||
- the logic is weird, at best
|
||||
- if value is 100, almost all levels are included
|
||||
- if value is 2.1, levels from half to double the current blind
|
||||
level are included
|
||||
- if value it 1, no aggregation is performed
|
||||
- defaults to 1
|
||||
- defines how many blind levels are included in stats displayed in HUD
|
||||
- if value is M, stats for blind levels are combined if the higher level
|
||||
is less than or equal to M times the lower blind level
|
||||
- defaults to 1, meaning only stats from current blind level are included
|
||||
- e.g. if set to 3 and current big blind is 50, stats for blind levels from
|
||||
16.7 (50 divided by 3) to big blind of 150 (50 times 3) are included
|
||||
-->
|
||||
<hud_ui
|
||||
stat_range="A"
|
||||
stat_days="90"
|
||||
aggregate_ring_game_stats="False"
|
||||
aggregate_tourney_stats="False"
|
||||
stat_aggregation_range="A"
|
||||
aggregation_days="90"
|
||||
aggregation_level_multiplier="1"
|
||||
aggregate_tourney_stats="True"
|
||||
aggregation_level_multiplier="3"
|
||||
|
||||
hero_stat_range="S"
|
||||
hero_stat_days="30"
|
||||
aggregate_hero_ring_game_stats="False"
|
||||
aggregate_hero_tourney_stats="True"
|
||||
hero_stat_aggregation_range="S"
|
||||
hero_aggregation_days="30"
|
||||
aggregate_hero_tourney_stats="False"
|
||||
hero_aggregation_level_multiplier="1"
|
||||
|
||||
label="FPDB Menu - Right-click
|
||||
|
|
|
@ -63,34 +63,6 @@ elif os.name == 'nt':
|
|||
import Hud
|
||||
|
||||
|
||||
# HUD params:
|
||||
# - Set aggregate_ring and/or aggregate_tour to True is you want to include stats from other blind levels in the HUD display
|
||||
# - If aggregation is used, the value of agg_bb_mult determines what levels are included. If
|
||||
# agg_bb_mult is M and current blind level is L, blinds between L/M and L*M are included. e.g.
|
||||
# if agg_bb_mult is 100, almost all levels are included in all HUD displays
|
||||
# if agg_bb_mult is 2, levels from half to double the current blind level are included in the HUD
|
||||
# if agg_bb_mult is 1 only the current level is included
|
||||
# - Set hud_style to A to see stats for all-time
|
||||
# Set hud_style to S to only see stats for current session (currently this shows stats for the last 24 hours)
|
||||
# Set hud_style to T to only see stats for the last N days (uses value in hud_days)
|
||||
# - Set hud_days to N to see stats for the last N days in the HUD (only applies if hud_style is T)
|
||||
def_hud_params = { # Settings for all players apart from program owner ('hero')
|
||||
'aggregate_ring' : False
|
||||
, 'aggregate_tour' : True
|
||||
, 'hud_style' : 'A'
|
||||
, 'hud_days' : 90
|
||||
, 'agg_bb_mult' : 10000 # 1 means no aggregation
|
||||
# , 'hud_session_gap' : 30 not currently used
|
||||
# Second set of variables for hero - these settings only apply to the program owner
|
||||
, 'h_aggregate_ring' : False
|
||||
, 'h_aggregate_tour' : True
|
||||
, 'h_hud_style' : 'S' # A(ll) / S(ession) / T(ime in days)
|
||||
, 'h_hud_days' : 60
|
||||
, 'h_agg_bb_mult' : 10000 # 1 means no aggregation
|
||||
# , 'h_hud_session_gap' : 30 not currently used
|
||||
}
|
||||
|
||||
|
||||
class HUD_main(object):
|
||||
"""A main() object to own both the read_stdin thread and the gui."""
|
||||
# This class mainly provides state for controlling the multiple HUDs.
|
||||
|
@ -159,6 +131,8 @@ class HUD_main(object):
|
|||
self.hud_dict[table_name].stat_dict = stat_dict
|
||||
self.hud_dict[table_name].cards = cards
|
||||
|
||||
# set agg_bb_mult so that aggregate_tour and aggregate_ring can be ignored,
|
||||
# agg_bb_mult == 1 means no aggregation after these if statements:
|
||||
if type == "tour" and self.hud_params['aggregate_tour'] == False:
|
||||
self.hud_dict[table_name].hud_params['agg_bb_mult'] = 1
|
||||
elif type == "ring" and self.hud_params['aggregate_ring'] == False:
|
||||
|
@ -167,8 +141,13 @@ class HUD_main(object):
|
|||
self.hud_dict[table_name].hud_params['h_agg_bb_mult'] = 1
|
||||
elif type == "ring" and self.hud_params['h_aggregate_ring'] == False:
|
||||
self.hud_dict[table_name].hud_params['h_agg_bb_mult'] = 1
|
||||
# sqlcoder: I forget why these are set to true (aren't they ignored from now on?)
|
||||
# but I think it's needed:
|
||||
self.hud_params['aggregate_ring'] == True
|
||||
self.hud_params['h_aggregate_ring'] == True
|
||||
# so maybe the tour ones should be set as well? does this fix the bug I see mentioned?
|
||||
self.hud_params['aggregate_tour'] = True
|
||||
self.hud_params['h_aggregate_tour'] == True
|
||||
|
||||
[aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[table_name].aux_windows]
|
||||
gobject.idle_add(idle_func)
|
||||
|
|
Loading…
Reference in New Issue
Block a user