Skip to content

Commit

Permalink
account for upload_date not being set when filtering media by date
Browse files Browse the repository at this point in the history
  • Loading branch information
meeb committed Jul 18, 2024
1 parent 68de807 commit ebbf654
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tubesync/sync/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ def calculate_episode_number(self):
sorted_media = Media.objects.filter(source=self.source)
else:
self_year = self.upload_date.year if self.upload_date else self.created.year
filtered_media = Media.objects.filter(source=self.source, published__year=self_year)
filtered_media = Media.objects.filter(source=self.source, published__year=self_year, upload_date__isnull=False)
sorted_media = sorted(filtered_media, key=lambda x: (x.upload_date, x.key))
position_counter = 1
for media in sorted_media:
Expand Down

0 comments on commit ebbf654

Please sign in to comment.