From 8514e9db17f3ac309cf7fb8bcf856089051cef79 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Tue, 23 Nov 2021 18:08:24 +0200 Subject: [PATCH 1/2] Update analyze_wotb_replays.py --- analyze_wotb_replays.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 72fffa2..7927716 100755 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -1587,7 +1587,8 @@ async def main(argv): players = get_players(results) replays = filter_replays(replays, results) - + if args.filters != None: + results = filter_results(results, args.filters, stats_filters=False) (player_stats, stat_id_map) = await process_player_stats(players, OPT_WORKERS_N, args, db) bu.debug('Number of player stats: ' + str(len(player_stats))) @@ -1815,6 +1816,7 @@ def process_battle_results(results: dict, args : argparse.Namespace): cats = BattleCategorizationList.get_categorizations(args) blt_cat_list= None + ## Move filtering to main() if args.filters != None: results = filter_results(results, args.filters) if len(results) > 0: @@ -1836,7 +1838,7 @@ def process_battle_results(results: dict, args : argparse.Namespace): 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""" try: filters = json.loads(filter_json) From d323f11662010f3b77a867235177a3c8e8e45192 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Tue, 23 Nov 2021 18:38:49 +0200 Subject: [PATCH 2/2] Update analyze_wotb_replays.py --- analyze_wotb_replays.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 7927716..bfd887c 100755 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -223,6 +223,12 @@ class BattleCategorizationList(): ] + _categorizations_stats = [ + 'player_wins', + 'player_battles', + 'player_battles' + ] + @classmethod def get_categorizations_all(cls): return cls._categorizations.keys() @@ -1587,10 +1593,13 @@ async def main(argv): players = get_players(results) replays = filter_replays(replays, results) - if args.filters != None: - results = filter_results(results, args.filters, stats_filters=False) + # 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) + # Filter based on stats filters + results = filter_results(results, args.filters, stats_filters=True) + bu.debug('Number of player stats: ' + str(len(player_stats))) teamresults = calc_team_stats(results, player_stats, stat_id_map, args) @@ -1809,6 +1818,7 @@ def print_player_dist(histograms: dict): print('') hist.print() + def process_battle_results(results: dict, args : argparse.Namespace): """Process replay battle results""" try: @@ -1816,9 +1826,7 @@ def process_battle_results(results: dict, args : argparse.Namespace): cats = BattleCategorizationList.get_categorizations(args) blt_cat_list= None - ## Move filtering to main() - if args.filters != None: - results = filter_results(results, args.filters) + # remove if? if len(results) > 0: blt_cat_list = BattleCategorizationList(cats) for result in results: