From e0224522b19349880b01cf4a41f3a86dd60187b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 21 Nov 2013 22:31:32 +0100 Subject: [PATCH] Full slicing in examiners assignment --- wtem/management/commands/wtem_assign_submissions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wtem/management/commands/wtem_assign_submissions.py b/wtem/management/commands/wtem_assign_submissions.py index afb99ca..b0f2a4f 100644 --- a/wtem/management/commands/wtem_assign_submissions.py +++ b/wtem/management/commands/wtem_assign_submissions.py @@ -24,9 +24,10 @@ class Command(BaseCommand): ) def handle(self, *args, **options): - how_many = int(args[0]) - examiner_names = args[1:] + limit_from = int(args[0]) + limit_to = int(args[1]) + examiner_names = args[2:] users = User.objects.filter(username__in = examiner_names) submissions_query = Submission.objects.annotate(examiners_count = Count('examiners')) @@ -40,7 +41,7 @@ class Command(BaseCommand): if options['no_attachments_only']: submissions = submissions.exclude(id__in = with_attachment_ids) - for submission in submissions.order_by('id')[0:how_many]: + for submission in submissions.order_by('id')[limit_from:limit_to]: submission.examiners.add(*users) submission.save() self.stdout.write('added to %s:%s' % (submission.id, submission.email)) -- 2.20.1