From 50d189d8edf2bf026cac70007526c1dfb16e8840 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 8 Dec 2024 15:48:24 +0100 Subject: [PATCH] feat: 'fix' last submission when submission types change --- pretalx_musicrate/__init__.py | 2 +- pretalx_musicrate/views.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pretalx_musicrate/__init__.py b/pretalx_musicrate/__init__.py index d362d01..b80dbc3 100644 --- a/pretalx_musicrate/__init__.py +++ b/pretalx_musicrate/__init__.py @@ -1 +1 @@ -__version__ = "2025.2.0" +__version__ = "2025.3.0.dev0" diff --git a/pretalx_musicrate/views.py b/pretalx_musicrate/views.py index e76234f..4ded69a 100644 --- a/pretalx_musicrate/views.py +++ b/pretalx_musicrate/views.py @@ -39,15 +39,14 @@ def get_last_submission(settings, submissions, submission=None): if submission is not None and submission.state != SubmissionStates.SUBMITTED: submission = None - return ( - submission - or submissions.filter( - submission_type__in=settings.submission_types.all(), - state=SubmissionStates.SUBMITTED, - ) - .order_by("created") - .first() + submissions = submissions.filter( + submission_type__in=settings.submission_types.all(), + state=SubmissionStates.SUBMITTED, ) + if submission is not None and not submissions.filter(pk=submission.pk).exists(): + submission = None + + return submission or submissions.order_by("created").first() class JoinView(TemplateView):