mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-21 10:17:05 +02:00
Merge branch 'stable-filter-update' into stable-filters-update2
This commit is contained in:
1 file changed
+16
-3
+16
-3
@@ -227,6 +227,12 @@ class BattleCategorizationList():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
_categorizations_stats = [
|
||||||
|
'player_wins',
|
||||||
|
'player_battles',
|
||||||
|
'player_battles'
|
||||||
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_categorizations_all(cls):
|
def get_categorizations_all(cls):
|
||||||
return cls._categorizations.keys()
|
return cls._categorizations.keys()
|
||||||
@@ -1591,7 +1597,14 @@ async def main(argv):
|
|||||||
players = get_players(results)
|
players = get_players(results)
|
||||||
replays = filter_replays(replays, results)
|
replays = filter_replays(replays, results)
|
||||||
|
|
||||||
|
# Filter based on non-stats filters
|
||||||
|
results = filter_results(results, args.filters, stats_filters=False)
|
||||||
|
|
||||||
(player_stats, stat_id_map) = await process_player_stats(players, OPT_WORKERS_N, args, db)
|
(player_stats, stat_id_map) = await process_player_stats(players, OPT_WORKERS_N, args, db)
|
||||||
|
|
||||||
|
# Filter based on stats filters
|
||||||
|
results = filter_results(results, args.filters, stats_filters=True)
|
||||||
|
|
||||||
bu.debug('Number of player stats: ' + str(len(player_stats)))
|
bu.debug('Number of player stats: ' + str(len(player_stats)))
|
||||||
teamresults = calc_team_stats(results, player_stats, stat_id_map, args)
|
teamresults = calc_team_stats(results, player_stats, stat_id_map, args)
|
||||||
|
|
||||||
@@ -1810,6 +1823,7 @@ def print_player_dist(histograms: dict):
|
|||||||
print('')
|
print('')
|
||||||
hist.print()
|
hist.print()
|
||||||
|
|
||||||
|
|
||||||
def process_battle_results(results: dict, args : argparse.Namespace):
|
def process_battle_results(results: dict, args : argparse.Namespace):
|
||||||
"""Process replay battle results"""
|
"""Process replay battle results"""
|
||||||
try:
|
try:
|
||||||
@@ -1817,8 +1831,7 @@ def process_battle_results(results: dict, args : argparse.Namespace):
|
|||||||
cats = BattleCategorizationList.get_categorizations(args)
|
cats = BattleCategorizationList.get_categorizations(args)
|
||||||
blt_cat_list= None
|
blt_cat_list= None
|
||||||
|
|
||||||
if args.filters != None:
|
# remove if?
|
||||||
results = filter_results(results, args.filters)
|
|
||||||
if len(results) > 0:
|
if len(results) > 0:
|
||||||
blt_cat_list = BattleCategorizationList(cats)
|
blt_cat_list = BattleCategorizationList(cats)
|
||||||
for result in results:
|
for result in results:
|
||||||
@@ -1838,7 +1851,7 @@ def process_battle_results(results: dict, args : argparse.Namespace):
|
|||||||
return blt_cat_list
|
return blt_cat_list
|
||||||
|
|
||||||
|
|
||||||
def filter_results(results: list, filter_json : str) -> bool:
|
def filter_results(results: list, filter_json : str, stats_filters=False) -> bool:
|
||||||
"""Filter replays based on battle category filters"""
|
"""Filter replays based on battle category filters"""
|
||||||
try:
|
try:
|
||||||
filters = json.loads(filter_json)
|
filters = json.loads(filter_json)
|
||||||
|
|||||||
Reference in new issue
Block a user