Do not assign submissions without answers
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 21 Nov 2013 16:36:13 +0000 (17:36 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:28:04 +0000 (11:28 +0100)
wtem/management/commands/wtem_assign_submissions.py

index f87b7f4..2ec816e 100644 (file)
@@ -16,7 +16,7 @@ class Command(BaseCommand):
         submissions_query = Submission.objects.annotate(examiners_count = Count('examiners'))
 
         submissions = submissions_query \
         submissions_query = Submission.objects.annotate(examiners_count = Count('examiners'))
 
         submissions = submissions_query \
-            .filter(examiners_count__lt=2)[0:how_many]
+            .filter(examiners_count__lt=2).exclude(answers = None)[0:how_many]
 
         for submission in submissions:
             submission.examiners.add(*users)
 
         for submission in submissions:
             submission.examiners.add(*users)