Sort submission on assignment
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 21 Nov 2013 16:48:20 +0000 (17:48 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:28:05 +0000 (11:28 +0100)
wtem/management/commands/wtem_assign_submissions.py

index 6d33ec8..fad2d3e 100644 (file)
@@ -33,7 +33,7 @@ class Command(BaseCommand):
             with_attachment_ids = Attachment.objects.values_list('submission_id', flat=True).all()
             submissions = submissions.filter(id__in = with_attachment_ids)
 
             with_attachment_ids = Attachment.objects.values_list('submission_id', flat=True).all()
             submissions = submissions.filter(id__in = with_attachment_ids)
 
-        for submission in submissions[0:how_many]:
+        for submission in submissions.order_by('id')[0:how_many]:
             submission.examiners.add(*users)
             submission.save()
             self.stdout.write('added to %s:%s' % (submission.id, submission.email))
             submission.examiners.add(*users)
             submission.save()
             self.stdout.write('added to %s:%s' % (submission.id, submission.email))