feat: include only 'submitted' submissions in rating

This commit is contained in:
Luca 2024-12-07 19:34:29 +01:00
parent 18af2a75e6
commit 660650c8da
2 changed files with 12 additions and 7 deletions

View File

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

View File

@ -16,7 +16,7 @@ from django.views.generic.detail import SingleObjectMixin
from django_context_decorator import context
from pretalx.common.views.mixins import EventPermissionRequired
from pretalx.orga.views.submission import BaseSubmissionList, SubmissionList
from pretalx.submission.models import Submission
from pretalx.submission.models import Submission, SubmissionStates
from .forms import (
AssigneeForm,
@ -61,7 +61,8 @@ class JoinView(TemplateView):
self.juror.last_submission
or self.request.event.pretalx_musicrate_settings.last_submission
or self.request.event.submissions.filter(
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all()
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all(),
state=SubmissionStates.SUBMITTED,
)
.order_by("created")
.first()
@ -87,7 +88,8 @@ class JoinView(TemplateView):
self.juror.last_submission
or self.request.event.pretalx_musicrate_settings.last_submission
or self.request.event.submissions.filter(
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all()
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all(),
state=SubmissionStates.SUBMITTED,
)
.order_by("created")
.first()
@ -143,7 +145,8 @@ class QRCodeView(EventPermissionRequired, TemplateView):
context["last_submission"] = (
self.request.event.pretalx_musicrate_settings.last_submission
or self.request.event.submissions.filter(
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all()
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all(),
state=SubmissionStates.SUBMITTED,
)
.order_by("created")
.first()
@ -157,7 +160,8 @@ class SubmissionMixin(SingleObjectMixin):
def get_queryset(self):
return self.request.event.submissions.prefetch_related("answers").filter(
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all()
submission_type__in=self.request.event.pretalx_musicrate_settings.submission_types.all(),
state=SubmissionStates.SUBMITTED,
)
@context
@ -410,7 +414,8 @@ class ExportView(EventPermissionRequired, View):
request.event.submissions.prefetch_related("answers")
.select_related("submission_type")
.filter(
submission_type__in=request.event.pretalx_musicrate_settings.submission_types.all()
submission_type__in=request.event.pretalx_musicrate_settings.submission_types.all(),
state=SubmissionStates.SUBMITTED,
)
.only("title", "submission_type__name")
.order_by("created")