Skip to content

Commit 317db77

Browse files
committed
next_episode respects loction.
1 parent 2240e92 commit 317db77

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

dj/main/views.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,8 +2657,19 @@ def episode(request, episode_id, episode_slug=None, edit_key=None):
26572657
show=show, location=location, state=episode.state)
26582658
except Episode.DoesNotExist:
26592659
try:
2660-
next_episode = episode.get_next_by_start(
2661-
show=show, state=episode.state)
2660+
print(f"{location.sequence=}")
2661+
next_location = Location.objects.filter(
2662+
show=show,
2663+
sequence__gt=location.sequence
2664+
).order_by("sequence").first()
2665+
print(f"{next_location=}")
2666+
2667+
next_episode = Episode.objects.filter(
2668+
show=show,
2669+
location=next_location,
2670+
state=episode.state,
2671+
).order_by("start").first()
2672+
print(f"{next_episode=}")
26622673
except Episode.DoesNotExist:
26632674
next_episode = None
26642675

0 commit comments

Comments
 (0)