feat(computescores): add option to include frozen jurors

This commit is contained in:
Luca 2025-02-23 17:45:55 +01:00
parent 97a1dbf33a
commit c5b39e1890
2 changed files with 13 additions and 6 deletions

View File

@ -1 +1 @@
__version__ = "2025.5.0"
__version__ = "2025.6.0.dev0"

View File

@ -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", type=bool
)
parser.add_argument("event")
def handle(self, *args, **kwargs):
@ -31,11 +34,15 @@ class Command(BaseCommand):
with scope(event=event):
submissions = {}
for juror in (
event.jurors.prefetch_related("ratings__submission")
.filter(frozen=False)
.order_by("token")
):
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")
)