checking if an answer is complete
[edumed.git] / stage2 / management / commands / stage2_mark_complete.py
index 0f239b7..3720afb 100644 (file)
@@ -9,6 +9,7 @@ class Command(BaseCommand):
     def handle(self, **options):
         assignment_count = Assignment.objects.count()
         for participant in Participant.objects.all():
-            if participant.answer_set.count() == assignment_count:
+            answers = participant.answer_set.all()
+            if len(answers) == assignment_count and all(answer.is_complete() for answer in answers):
                 participant.complete_set = True
                 participant.save()