Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
d319559272 | |
|
1b264054fc | |
|
c5b39e1890 | |
|
97a1dbf33a | |
|
27e0b1e2c5 | |
|
ec3acac3fc |
|
@ -1 +1 @@
|
|||
__version__ = "2025.4.0"
|
||||
__version__ = "2025.6.1"
|
||||
|
|
|
@ -62,12 +62,9 @@ class AssigneeForm(forms.ModelForm):
|
|||
except Assignee.DoesNotExist:
|
||||
self.instance = Assignee(submission=submission)
|
||||
super().__init__(*args, instance=self.instance, **kwargs)
|
||||
self.fields["user"].queryset = User.objects.none().union(
|
||||
*(
|
||||
t.members.all()
|
||||
for t in submission.event.teams.filter(can_change_submissions=True)
|
||||
)
|
||||
)
|
||||
self.fields["user"].queryset = User.objects.filter(
|
||||
teams__in=submission.event.teams, teams__can_change_submissions=True
|
||||
).distinct()
|
||||
|
||||
class Meta:
|
||||
model = Assignee
|
||||
|
|
|
@ -20,6 +20,9 @@ class Command(BaseCommand):
|
|||
help = "Compute submission scores from ratings"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"-a", "--all", action="store_true", help="include frozen jurors"
|
||||
)
|
||||
parser.add_argument("event")
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
|
@ -31,9 +34,15 @@ class Command(BaseCommand):
|
|||
with scope(event=event):
|
||||
submissions = {}
|
||||
|
||||
for juror in event.jurors.prefetch_related("ratings__submission").order_by(
|
||||
jurors = event.jurors.prefetch_related("ratings__submission").order_by(
|
||||
"token"
|
||||
):
|
||||
)
|
||||
if not kwargs["all"]:
|
||||
jurors = jurors.filter(frozen=False)
|
||||
|
||||
self.stderr.write(f"computing scores from {jurors.count()} jurors")
|
||||
|
||||
for juror in jurors:
|
||||
ratings = list(
|
||||
juror.ratings.exclude(rating="").order_by("submission__created")
|
||||
)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.1.5 on 2025-02-23 13:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("pretalx_musicrate", "0009_score"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="juror",
|
||||
name="frozen",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
|
@ -78,6 +78,7 @@ class Juror(models.Model):
|
|||
related_name="jurors",
|
||||
null=True,
|
||||
)
|
||||
frozen = models.BooleanField(default=False)
|
||||
|
||||
|
||||
class Rating(models.Model):
|
||||
|
|
|
@ -54,7 +54,7 @@ class JoinView(TemplateView):
|
|||
|
||||
def validate_token(self, token):
|
||||
try:
|
||||
self.juror = Juror.objects.get(token=token)
|
||||
self.juror = Juror.objects.get(token=token, frozen=False)
|
||||
return True
|
||||
except Juror.DoesNotExist:
|
||||
self.juror = None
|
||||
|
@ -256,7 +256,7 @@ class RatingView(FormView, SubmissionMixin):
|
|||
@cached_property
|
||||
def juror(self):
|
||||
return get_object_or_404(
|
||||
Juror, token=self.request.resolver_match.kwargs["token"]
|
||||
Juror, token=self.request.resolver_match.kwargs["token"], frozen=False
|
||||
)
|
||||
|
||||
@context
|
||||
|
@ -384,8 +384,8 @@ class MayAdvanceView(EventPermissionRequired, SubmissionMixin, View):
|
|||
permission_required = "orga.view_submissions"
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
num_ratings = self.submission.ratings.count()
|
||||
num_jurors = self.request.event.jurors.count()
|
||||
num_ratings = self.submission.ratings.filter(juror__frozen=False).count()
|
||||
num_jurors = self.request.event.jurors.filter(frozen=False).count()
|
||||
return JsonResponse(
|
||||
{
|
||||
"mayAdvance": num_ratings
|
||||
|
@ -417,7 +417,7 @@ class ExportView(EventPermissionRequired, View):
|
|||
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")
|
||||
jurors = request.event.jurors.filter(frozen=False).order_by("token")
|
||||
for submission in (
|
||||
request.event.submissions.prefetch_related("answers")
|
||||
.select_related("submission_type")
|
||||
|
|
Loading…
Reference in New Issue