From d8c6ce2a5ea1faa2439d71e6be0f2864df601ed8 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 27 Mar 2026 03:02:55 -0500 Subject: [PATCH] fix: replace row-by-row DELETE with bulk DELETE in career recalculation (#77) Closes #77 Co-Authored-By: Claude Sonnet 4.6 --- app/db_engine.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/db_engine.py b/app/db_engine.py index c1979cf..a88825f 100644 --- a/app/db_engine.py +++ b/app/db_engine.py @@ -1372,9 +1372,7 @@ class BattingCareer(BaseModel): @staticmethod def recalculate(): # Wipe existing data - delete_lines = BattingCareer.select() - for line in delete_lines: - line.delete_instance() + BattingCareer.delete().execute() # For each seasonstat, find career or create new and increment for this_season in BattingSeason.select().where(BattingSeason.season_type == 'Regular'): @@ -1433,9 +1431,7 @@ class PitchingCareer(BaseModel): @staticmethod def recalculate(): # Wipe existing data - delete_lines = PitchingCareer.select() - for line in delete_lines: - line.delete_instance() + PitchingCareer.delete().execute() # For each seasonstat, find career or create new and increment for this_season in PitchingSeason.select().where(PitchingSeason.season_type == 'Regular'): @@ -1483,9 +1479,7 @@ class FieldingCareer(BaseModel): @staticmethod def recalculate(): # Wipe existing data - delete_lines = FieldingCareer.select() - for line in delete_lines: - line.delete_instance() + FieldingCareer.delete().execute() # For each seasonstat, find career or create new and increment for this_season in FieldingSeason.select().where(FieldingSeason.season_type == 'Regular'): -- 2.25.1