diff --git a/pretalx_musicrate/__init__.py b/pretalx_musicrate/__init__.py index 3b4a036..d75d15c 100644 --- a/pretalx_musicrate/__init__.py +++ b/pretalx_musicrate/__init__.py @@ -1 +1 @@ -__version__ = "2025.3.0" +__version__ = "2025.4.0.dev0" diff --git a/pretalx_musicrate/locale/de_DE/LC_MESSAGES/django.po b/pretalx_musicrate/locale/de_DE/LC_MESSAGES/django.po index d36a7f7..c1a8a13 100644 --- a/pretalx_musicrate/locale/de_DE/LC_MESSAGES/django.po +++ b/pretalx_musicrate/locale/de_DE/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: pretalx-musicrate 0.9.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 19:23+0100\n" -"PO-Revision-Date: 2024-02-14 22:30+0100\n" +"POT-Creation-Date: 2024-12-09 22:22+0100\n" +"PO-Revision-Date: 2024-12-09 22:23+0100\n" "Last-Translator: Luca \n" "Language-Team: Luca \n" "Language: de_DE\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.1\n" +"X-Generator: Poedit 3.4.2\n" #: pretalx_musicrate/apps.py:12 pretalx_musicrate/signals.py:59 msgid "pretalx-musicrate" @@ -194,31 +194,35 @@ msgstr "pretalx-musicrate-Einstellungen" msgid "Export ratings" msgstr "Bewertungen exportieren" -#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:29 +#: pretalx_musicrate/templates/pretalx_musicrate/settings.html:16 +msgid "Export scores" +msgstr "Auswertung exportieren" + +#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:34 msgid "(not specified)" msgstr "(nicht angegeben)" -#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:42 +#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:47 msgid "Previous" msgstr "Zurück" -#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:50 +#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:55 msgid "Next" msgstr "Weiter" -#: pretalx_musicrate/views.py:48 +#: pretalx_musicrate/views.py:66 msgid "Invalid token" msgstr "Ungültiges Token" -#: pretalx_musicrate/views.py:123 +#: pretalx_musicrate/views.py:133 msgid "The pretalx-musicrate settings were updated." msgstr "Die pretalx-musicrate-Einstellungen wurden gespeichert." -#: pretalx_musicrate/views.py:282 pretalx_musicrate/views.py:469 +#: pretalx_musicrate/views.py:289 pretalx_musicrate/views.py:482 msgid "Saved!" msgstr "Gespeichert!" -#: pretalx_musicrate/views.py:386 +#: pretalx_musicrate/views.py:398 #, python-format msgid "%(num_ratings)d of %(num_jurors)d has rated this submission" msgid_plural "%(num_ratings)d of %(num_jurors)d have rated this submission" diff --git a/pretalx_musicrate/templates/pretalx_musicrate/settings.html b/pretalx_musicrate/templates/pretalx_musicrate/settings.html index 2ad8452..c4cdf23 100644 --- a/pretalx_musicrate/templates/pretalx_musicrate/settings.html +++ b/pretalx_musicrate/templates/pretalx_musicrate/settings.html @@ -11,4 +11,8 @@ {% translate "Export ratings" %} + + + {% translate "Export scores" %} + {% endblock %} diff --git a/pretalx_musicrate/urls.py b/pretalx_musicrate/urls.py index 211143a..064a6ae 100644 --- a/pretalx_musicrate/urls.py +++ b/pretalx_musicrate/urls.py @@ -11,6 +11,7 @@ from .views import ( PresenterView, QRCodeView, RatingView, + ScoreExportView, ) urlpatterns = [ @@ -33,6 +34,7 @@ urlpatterns = [ EnhancedSubmissionList.as_view(), name="enhanced_list", ), + path("scores/", ScoreExportView.as_view(), name="scores"), path("/", AssigneeView.as_view(), name="assignee"), ] ), diff --git a/pretalx_musicrate/views.py b/pretalx_musicrate/views.py index 4ded69a..0a3d9ea 100644 --- a/pretalx_musicrate/views.py +++ b/pretalx_musicrate/views.py @@ -4,7 +4,7 @@ from hmac import compare_digest from urllib.parse import parse_qs, urlparse from django.contrib import messages -from django.db.models import Case, FilteredRelation, Q, Value, When +from django.db.models import Case, F, FilteredRelation, Q, Value, When from django.http import HttpResponse, JsonResponse from django.shortcuts import get_object_or_404, redirect from django.urls import reverse @@ -422,8 +422,7 @@ 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(), - state=SubmissionStates.SUBMITTED, + submission_type__in=request.event.pretalx_musicrate_settings.submission_types.all() ) .only("title", "submission_type__name") .order_by("created") @@ -514,3 +513,27 @@ class EnhancedSubmissionList(SubmissionList): if not self.filter_form.is_valid(): return qs return self.filter_form.filter_queryset(qs) + + +class ScoreExportView(EventPermissionRequired, View): + permission_required = "orga.view_submissions" + + def get(self, request, *args, **kwargs): + response = HttpResponse( + content_type="text/csv", + headers={ + "Content-Disposition": f'attachment; filename="{request.event.slug}.csv"' + }, + ) + + csv.writer(response).writerows( + request.event.submissions.select_related("score", "submission_type") + .filter( + submission_type__in=request.event.pretalx_musicrate_settings.submission_types.all() + ) + .exclude(state__in=(SubmissionStates.CANCELED, SubmissionStates.WITHDRAWN)) + .order_by(F("score__value").desc(nulls_last=True)) + .values_list("score__value", "title") + ) + + return response