Skip to content

Commit 5d01f80

Browse files
committed
save season before bulk create episodes
1 parent add6d68 commit 5d01f80

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/app/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def completed(self: "TV") -> None:
144144
"""Create remaining seasons and episodes for a TV show."""
145145

146146
seasons_to_update = []
147-
seasons_to_create = []
148147
episodes_to_create = []
149148

150149
tv_metadata = tmdb.tv(self.media_id)
@@ -175,13 +174,12 @@ def completed(self: "TV") -> None:
175174
related_tv=self,
176175
user=self.user,
177176
)
178-
seasons_to_create.append(season_instance)
177+
Season.save_base(season_instance)
179178
episodes_to_create.extend(
180179
season_instance.get_remaining_eps(season_metadata),
181180
)
182181

183182
Season.objects.bulk_update(seasons_to_update, ["status"])
184-
Season.objects.bulk_create(seasons_to_create)
185183
Episode.objects.bulk_create(episodes_to_create)
186184

187185

0 commit comments

Comments
 (0)