feat(computescores): add option to include frozen jurors
This commit is contained in:
parent
97a1dbf33a
commit
c5b39e1890
|
@ -1 +1 @@
|
|||
__version__ = "2025.5.0"
|
||||
__version__ = "2025.6.0.dev0"
|
||||
|
|
|
@ -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")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue