Only create GradingRecords for succeful projects or failed projects with Surveys.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 24 Aug 2009 23:52:48 +0200
changeset 2794 dd841c3160d8
parent 2793 8c88226b27e7
child 2795 776aae4d0499
Only create GradingRecords for succeful projects or failed projects with Surveys. This is done because it has no use to create new GradingRecords for already failed/invalid projects because the outcome of this one will have no changing effect on the status.
app/soc/logic/models/grading_record.py
--- a/app/soc/logic/models/grading_record.py	Mon Aug 24 18:44:41 2009 +0200
+++ b/app/soc/logic/models/grading_record.py	Mon Aug 24 23:52:48 2009 +0200
@@ -67,6 +67,13 @@
                                                      survey_group,
                                                      record_entity)
 
+      if not record_entity and project_entity.status in ['failed', 'invalid'] \
+          and not record_fields['mentor_record'] \
+          and not record_fields['student_record']:
+        # Don't create a new GradingRecord for an already failed project which
+        # has no records attached. Because it does not matter.
+        continue
+
       if record_entity:
         # update existing GradingRecord
         for key,value in record_fields.iteritems():