fix: replace row-by-row DELETE with bulk DELETE in career recalculation (#77) #92
@ -1372,9 +1372,7 @@ class BattingCareer(BaseModel):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def recalculate():
|
def recalculate():
|
||||||
# Wipe existing data
|
# Wipe existing data
|
||||||
delete_lines = BattingCareer.select()
|
BattingCareer.delete().execute()
|
||||||
for line in delete_lines:
|
|
||||||
line.delete_instance()
|
|
||||||
|
|
||||||
# For each seasonstat, find career or create new and increment
|
# For each seasonstat, find career or create new and increment
|
||||||
for this_season in BattingSeason.select().where(BattingSeason.season_type == 'Regular'):
|
for this_season in BattingSeason.select().where(BattingSeason.season_type == 'Regular'):
|
||||||
@ -1433,9 +1431,7 @@ class PitchingCareer(BaseModel):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def recalculate():
|
def recalculate():
|
||||||
# Wipe existing data
|
# Wipe existing data
|
||||||
delete_lines = PitchingCareer.select()
|
PitchingCareer.delete().execute()
|
||||||
for line in delete_lines:
|
|
||||||
line.delete_instance()
|
|
||||||
|
|
||||||
# For each seasonstat, find career or create new and increment
|
# For each seasonstat, find career or create new and increment
|
||||||
for this_season in PitchingSeason.select().where(PitchingSeason.season_type == 'Regular'):
|
for this_season in PitchingSeason.select().where(PitchingSeason.season_type == 'Regular'):
|
||||||
@ -1483,9 +1479,7 @@ class FieldingCareer(BaseModel):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def recalculate():
|
def recalculate():
|
||||||
# Wipe existing data
|
# Wipe existing data
|
||||||
delete_lines = FieldingCareer.select()
|
FieldingCareer.delete().execute()
|
||||||
for line in delete_lines:
|
|
||||||
line.delete_instance()
|
|
||||||
|
|
||||||
# For each seasonstat, find career or create new and increment
|
# For each seasonstat, find career or create new and increment
|
||||||
for this_season in FieldingSeason.select().where(FieldingSeason.season_type == 'Regular'):
|
for this_season in FieldingSeason.select().where(FieldingSeason.season_type == 'Regular'):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user