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"
|
help = "Compute submission scores from ratings"
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
"-a", "--all", action="store_true", help="include frozen jurors", type=bool
|
||||||
|
)
|
||||||
parser.add_argument("event")
|
parser.add_argument("event")
|
||||||
|
|
||||||
def handle(self, *args, **kwargs):
|
def handle(self, *args, **kwargs):
|
||||||
|
@ -31,11 +34,15 @@ class Command(BaseCommand):
|
||||||
with scope(event=event):
|
with scope(event=event):
|
||||||
submissions = {}
|
submissions = {}
|
||||||
|
|
||||||
for juror in (
|
jurors = event.jurors.prefetch_related("ratings__submission").order_by(
|
||||||
event.jurors.prefetch_related("ratings__submission")
|
"token"
|
||||||
.filter(frozen=False)
|
)
|
||||||
.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(
|
ratings = list(
|
||||||
juror.ratings.exclude(rating="").order_by("submission__created")
|
juror.ratings.exclude(rating="").order_by("submission__created")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue