feat: 'fix' last submission when submission types change

This commit is contained in:
Luca 2024-12-08 15:48:24 +01:00
parent f8f95db5c3
commit 50d189d8ed
2 changed files with 8 additions and 9 deletions

View File

@ -1 +1 @@
__version__ = "2025.2.0"
__version__ = "2025.3.0.dev0"

View File

@ -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):