feat(export): sort submissions and optimize query
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Luca 2023-12-18 02:23:44 +01:00
parent 57317b51d2
commit d2ca7db7aa
2 changed files with 9 additions and 3 deletions

View File

@ -1 +1 @@
__version__ = "0.9.0" __version__ = "0.10.0"

View File

@ -397,8 +397,14 @@ class ExportView(EventPermissionRequired, View):
genre_question = request.event.pretalx_musicrate_settings.genre_question genre_question = request.event.pretalx_musicrate_settings.genre_question
origin_question = request.event.pretalx_musicrate_settings.origin_question origin_question = request.event.pretalx_musicrate_settings.origin_question
jurors = request.event.jurors.order_by("token") jurors = request.event.jurors.order_by("token")
for submission in request.event.submissions.prefetch_related("answers").filter( for submission in (
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()
)
.only("title", "submission_type__name")
.order_by("created")
): ):
submission_info = [submission.title, submission.submission_type.name] submission_info = [submission.title, submission.submission_type.name]
if genre_question is not None: if genre_question is not None: