Compare commits
No commits in common. "57317b51d2b52155150f76f93ee5e559626c3efb" and "049062d5bb3c22e22c3a7dd1d8ded586ba7f0eeb" have entirely different histories.
57317b51d2
...
049062d5bb
|
@ -1 +1 @@
|
|||
__version__ = "0.9.0"
|
||||
__version__ = "0.8.0"
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: pretalx-musicrate 0.9.0\n"
|
||||
"Project-Id-Version: pretalx-musicrate 0.0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-12-18 01:34+0100\n"
|
||||
"PO-Revision-Date: 2023-12-18 01:36+0100\n"
|
||||
"POT-Creation-Date: 2023-12-16 03:23+0100\n"
|
||||
"PO-Revision-Date: 2023-12-16 03:24+0100\n"
|
||||
"Last-Translator: Luca <Luca@hackerspace-bamberg.de>\n"
|
||||
"Language-Team: Luca <Luca@hackerspace-bamberg.de>\n"
|
||||
"Language: de_DE\n"
|
||||
|
@ -93,14 +93,6 @@ msgstr "Zum Anhörtag"
|
|||
msgid "pretalx-musicrate settings"
|
||||
msgstr "pretalx-musicrate-Einstellungen"
|
||||
|
||||
#: pretalx_musicrate/templates/pretalx_musicrate/settings.html:22
|
||||
msgid "Save"
|
||||
msgstr "Speichern"
|
||||
|
||||
#: pretalx_musicrate/templates/pretalx_musicrate/settings.html:30
|
||||
msgid "Export ratings"
|
||||
msgstr "Bewertungen exportieren"
|
||||
|
||||
#: pretalx_musicrate/templates/pretalx_musicrate/submission_base.html:29
|
||||
msgid "(not specified)"
|
||||
msgstr "(nicht angegeben)"
|
||||
|
@ -113,19 +105,19 @@ msgstr "Zurück"
|
|||
msgid "Next"
|
||||
msgstr "Weiter"
|
||||
|
||||
#: pretalx_musicrate/views.py:41
|
||||
#: pretalx_musicrate/views.py:39
|
||||
msgid "Invalid token"
|
||||
msgstr "Ungültiges Token"
|
||||
|
||||
#: pretalx_musicrate/views.py:116
|
||||
#: pretalx_musicrate/views.py:114
|
||||
msgid "The pretalx-musicrate settings were updated."
|
||||
msgstr "Die pretalx-musicrate-Einstellungen wurden gespeichert."
|
||||
|
||||
#: pretalx_musicrate/views.py:275
|
||||
#: pretalx_musicrate/views.py:273
|
||||
msgid "Saved!"
|
||||
msgstr "Gespeichert!"
|
||||
|
||||
#: pretalx_musicrate/views.py:377
|
||||
#: pretalx_musicrate/views.py:375
|
||||
#, 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"
|
||||
|
|
|
@ -10,7 +10,7 @@ def pretalx_musicrate_qrcode(sender, request, **kwargs):
|
|||
return []
|
||||
return [
|
||||
{
|
||||
"active": request.resolver_match.view_name
|
||||
"active": request.resolver_match.url_name
|
||||
== "plugins:pretalx_musicrate:qrcode",
|
||||
"icon": "star",
|
||||
"label": _("Collective Rating"),
|
||||
|
@ -29,10 +29,10 @@ def pretalx_musicrate_settings(sender, request, **kwargs):
|
|||
{
|
||||
"label": "pretalx-musicrate",
|
||||
"url": reverse(
|
||||
"plugins:pretalx_musicrate:settings.musicrate",
|
||||
"plugins:pretalx_musicrate:settings",
|
||||
kwargs={"event": request.event.slug},
|
||||
),
|
||||
"active": request.resolver_match.view_name
|
||||
== "plugins:pretalx_musicrate:settings.musicrate",
|
||||
"active": request.resolver_match.url_name
|
||||
== "plugins:pretalx_musicrate:settings",
|
||||
}
|
||||
]
|
||||
|
|
|
@ -24,9 +24,4 @@
|
|||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<a class="btn btn-success btn-lg btn-block" href="{% url "plugins:pretalx_musicrate:export" event=request.event.slug %}">
|
||||
<i class="fa fa-download"></i>
|
||||
{% translate "Export ratings" %}
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.urls import include, path
|
||||
|
||||
from .views import (
|
||||
ExportView,
|
||||
JoinView,
|
||||
MayAdvanceView,
|
||||
MusicrateSettingsView,
|
||||
|
@ -13,12 +12,8 @@ from .views import (
|
|||
urlpatterns = [
|
||||
path(
|
||||
"orga/event/<slug:event>/settings/p/pretalx_musicrate/",
|
||||
include(
|
||||
[
|
||||
path("", MusicrateSettingsView.as_view(), name="settings.musicrate"),
|
||||
path("export/", ExportView.as_view(), name="export"),
|
||||
]
|
||||
),
|
||||
MusicrateSettingsView.as_view(),
|
||||
name="settings",
|
||||
),
|
||||
path(
|
||||
"<slug:event>/p/pretalx_musicrate/",
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import csv
|
||||
import re
|
||||
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.http import HttpResponse, JsonResponse
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
|
@ -381,53 +379,3 @@ class MayAdvanceView(EventPermissionRequired, SubmissionMixin, View):
|
|||
% {"num_jurors": num_jurors, "num_ratings": num_ratings},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class ExportView(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"'
|
||||
},
|
||||
)
|
||||
writer = csv.writer(response)
|
||||
genre_question = request.event.pretalx_musicrate_settings.genre_question
|
||||
origin_question = request.event.pretalx_musicrate_settings.origin_question
|
||||
jurors = request.event.jurors.order_by("token")
|
||||
for submission in request.event.submissions.prefetch_related("answers").filter(
|
||||
submission_type__in=request.event.pretalx_musicrate_settings.submission_types.all()
|
||||
):
|
||||
submission_info = [submission.title, submission.submission_type.name]
|
||||
if genre_question is not None:
|
||||
submission_info.append(
|
||||
submission.answers.filter(question=genre_question)
|
||||
.values_list("answer", flat=True)
|
||||
.first()
|
||||
or ""
|
||||
)
|
||||
if origin_question is not None:
|
||||
submission_info.append(
|
||||
submission.answers.filter(question=origin_question)
|
||||
.values_list("answer", flat=True)
|
||||
.first()
|
||||
or ""
|
||||
)
|
||||
writer.writerow(
|
||||
[
|
||||
*submission_info,
|
||||
*jurors.annotate(
|
||||
filtered_ratings=FilteredRelation(
|
||||
"ratings", condition=Q(ratings__submission=submission)
|
||||
),
|
||||
rating=Case(
|
||||
When(filtered_ratings__rating=None, then=Value("")),
|
||||
When(filtered_ratings__rating="", then=Value("E")),
|
||||
default="filtered_ratings__rating",
|
||||
),
|
||||
).values_list("rating", flat=True),
|
||||
]
|
||||
)
|
||||
return response
|
||||
|
|
Loading…
Reference in New Issue