Changed the StudentProject model to handle a dynamic amount of GradeRecords.
authorLennard de Rijk <ljvderijk@gmail.com>
Wed, 08 Jul 2009 15:44:54 +0200
changeset 2573 f09f317769c4
parent 2572 1ad6d986be6d
child 2574 402e4a979e77
Changed the StudentProject model to handle a dynamic amount of GradeRecords. This allows for a dynamic amount of moments where a StudentProject can be evaluated. Also included in this patch are changes to the status property that will help to enable PA's to withdraw StudentProjects from the program without the need for a developer to step in.
app/soc/models/student_project.py
app/soc/views/models/organization.py
app/soc/views/models/student_project.py
--- a/app/soc/models/student_project.py	Wed Jul 08 11:50:02 2009 +0200
+++ b/app/soc/models/student_project.py	Wed Jul 08 15:44:54 2009 +0200
@@ -75,13 +75,21 @@
 
   #: The status of this project
   #: accepted: This project has been accepted into the program
-  #: mid_term_passed: This project has passed the midterm evaluation
-  #: mid_term_failed: This project has failed the midterm evaluation
-  #: final_failed: This project has failed the final evaluation
-  #: passed: This project has completed the program successfully
+  #: failed: This project has failed an evaluation.
+  #: completed: This project has completed the program successfully. This
+  #:            should be set automatically when a program has been deemed
+  #:            finished.
+  #: withdrawn: This project has been withdrawn from the program by a Program
+  #:            Administrator or higher.
+  #: invalid: This project has been marked as invalid because it was deleted
   status = db.StringProperty(required=True, default='accepted',
-      choices=['accepted', 'mid_term_passed', 'mid_term_failed', 
-              'final_failed', 'passed'])
+      choices=['accepted', 'failed', 'completed', 'withdrawn', 'invalid'])
+
+  #: List of all processed GradingRecords which state a pass for this project.
+  #: This property can be used to determine how many evaluations someone has
+  #: passed. And is also used to ensure that a GradingRecord has been
+  #: processed.
+  passed_evaluations = db.ListProperty(item_type=db.Key, default=[])
 
   #: Student which this project is from
   student = db.ReferenceProperty(
--- a/app/soc/views/models/organization.py	Wed Jul 08 11:50:02 2009 +0200
+++ b/app/soc/views/models/organization.py	Wed Jul 08 15:44:54 2009 +0200
@@ -493,7 +493,7 @@
 
       # only show projects that have not failed
       filter = {'scope': entity,
-                'status': ['accepted', 'mid_term_passed', 'passed']}
+                'status': ['accepted', 'completed']}
 
       ap_list = lists.getListContent(request, ap_params, filter, idx=0,
                                      need_content=True)
--- a/app/soc/views/models/student_project.py	Wed Jul 08 11:50:02 2009 +0200
+++ b/app/soc/views/models/student_project.py	Wed Jul 08 15:44:54 2009 +0200
@@ -72,13 +72,13 @@
     rights['list'] = ['checkIsDeveloper']
     rights['manage'] = [('checkHasActiveRoleForScope',
                          org_admin_logic),
-        ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed']])]
+        ('checkStudentProjectHasStatus', [['accepted']])]
     rights['manage_overview'] = [('checkHasActiveRoleForScope',
                          org_admin_logic)]
     # TODO: lack of better name here!
     rights['st_edit'] = ['checkIsMyStudentProject',
         ('checkStudentProjectHasStatus',
-            [['accepted', 'mid_term_passed', 'passed']])
+            [['accepted', 'completed']])
         ]
 
     new_params = {}
@@ -95,7 +95,7 @@
 
     new_params['extra_dynaexclude'] = ['program', 'status', 'link_id',
                                        'mentor', 'additional_mentors',
-                                       'student']
+                                       'student', 'passed_evaluations']
 
     new_params['create_extra_dynaproperties'] = {
         'scope_path': forms.CharField(widget=forms.HiddenInput,
@@ -490,7 +490,7 @@
     list_params = params.copy()
 
     #list all active projects
-    fields['status'] = ['accepted', 'mid_term_passed']
+    fields['status'] = 'accepted'
     active_params = list_params.copy()
     active_params['list_description'] = \
         'List of all active %(name_plural)s' % list_params
@@ -500,7 +500,7 @@
         request, active_params, fields, idx=0)
 
     # list all failed projects
-    fields['status'] = ['mid_term_failed', 'final_failed']
+    fields['status'] = 'failed'
     failed_params = list_params.copy()
     failed_params['list_description'] = ('List of all failed %(name_plural)s, '
         'these cannot be managed.') % list_params
@@ -510,7 +510,7 @@
         request, failed_params, fields, idx=1, need_content=True)
 
     #list all completed projects
-    fields['status'] = ['passed']
+    fields['status'] = 'completed'
     completed_params = list_params.copy()
     completed_params['list_description'] = ('List of %(name_plural)s that have '
         'successfully completed the program, '