|
|
|
@ -88,6 +88,13 @@ class RedirectToNextOpenPart(LoginRequiredMixin, RedirectView):
|
|
|
|
|
def get_redirect_url(self, *args, **kwargs):
|
|
|
|
|
story_round = get_object_or_404(StoryRound, pk=kwargs['story_round_pk'])
|
|
|
|
|
|
|
|
|
|
if story_round.next_round_ready():
|
|
|
|
|
status, turn_number = story_round.advance_to_next_turn_and_get_status_and_round_number()
|
|
|
|
|
if status == 'finished':
|
|
|
|
|
self.pattern_name = 'writing:finished'
|
|
|
|
|
kwargs['pk'] = kwargs.pop('story_round_pk')
|
|
|
|
|
return super().get_redirect_url(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
story_part = story_round.get_next_story_part(user=self.request.user)
|
|
|
|
|
|
|
|
|
|
if story_part.finished:
|
|
|
|
@ -96,6 +103,7 @@ class RedirectToNextOpenPart(LoginRequiredMixin, RedirectView):
|
|
|
|
|
else:
|
|
|
|
|
kwargs['story_pk'] = story_part.part_of.pk
|
|
|
|
|
kwargs['pk'] = story_part.pk
|
|
|
|
|
|
|
|
|
|
return super().get_redirect_url(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|