From 4967d719b5fba70b4ac0fd0d0fb7b67653f18023 Mon Sep 17 00:00:00 2001 From: Samuel Cattini-Schultz Date: Mon, 3 Jun 2024 15:02:55 +1000 Subject: [PATCH] Fix tqdm progressing on errors in recalculate --- profiles/management/commands/recalculate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/management/commands/recalculate.py b/profiles/management/commands/recalculate.py index 7f98769..18b8312 100644 --- a/profiles/management/commands/recalculate.py +++ b/profiles/management/commands/recalculate.py @@ -266,6 +266,7 @@ def recalculate_beatmaps_v2( while len(page := beatmaps_to_recalculate[:2000]) > 0: try: update_difficulty_calculations(page, difficulty_calculator) + pbar.update(len(page)) except CalculationException as e: ErrorReporter().report_error(e) pbar.write( @@ -273,7 +274,6 @@ def recalculate_beatmaps_v2( f"Error calculating difficulty values for beatmaps: {e}" ) ) - pbar.update(len(page)) self.stdout.write( self.style.SUCCESS( @@ -357,6 +357,7 @@ def recalculate_scores_v2( unique_beatmap_scores, difficulty_calculator, ) + pbar.update(unique_beatmap_scores.count()) except CalculationException as e: ErrorReporter().report_error(e) pbar.write( @@ -364,7 +365,6 @@ def recalculate_scores_v2( f"Error calculating performance values for beatmap {unique_beatmap['beatmap_id']} with mods {unique_beatmap['mods']}: {e}" ) ) - pbar.update(unique_beatmap_scores.count()) self.stdout.write( self.style.SUCCESS(