fix: replace row-by-row DELETE with bulk DELETE in career recalculation (#77)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m4s

Closes #77

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-27 03:02:55 -05:00
parent da679b6d1a
commit d8c6ce2a5e

View File

@ -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'):