|
1 #!/usr/bin/python2.5 |
|
2 # |
|
3 # Copyright 2009 the Melange authors. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 |
|
17 """GradingRecord represents a cluster (mentor/student) of SurveyRecords |
|
18 for an evaluation period. |
|
19 """ |
|
20 |
|
21 __authors__ = [ |
|
22 '"Daniel Diniz" <ajaksu@gmail.com>', |
|
23 '"James Levy" <jamesalexanderlevy@gmail.com>', |
|
24 '"Lennard de Rijk" <ljvderijk@gmail.com>', |
|
25 ] |
|
26 |
|
27 |
|
28 from google.appengine.ext import db |
|
29 |
|
30 from django.utils.translation import ugettext |
|
31 |
|
32 from soc.models import base |
|
33 from soc.models.grading_project_survey_record import GradingProjectSurveyRecord |
|
34 from soc.models.grading_survey_group import GradingSurveyGroup |
|
35 from soc.models.project_survey_record import ProjectSurveyRecord |
|
36 from soc.models.student_project import StudentProject |
|
37 |
|
38 |
|
39 class GradingRecord(base.ModelWithFieldAttributes): |
|
40 """Explicitly group SurveyRecords with a common project. |
|
41 |
|
42 Because Mentors and Students take different surveys, |
|
43 we cannot simply link survey records by a common project and survey. |
|
44 |
|
45 Instead, we establish a GradingRecord. |
|
46 |
|
47 A GradingRecord links a group of survey records with a common |
|
48 project, and links back to its records. |
|
49 |
|
50 This entity can be edited by Program Administrators to edit the outcome |
|
51 of a the Grading surveys without touching the real survey's answers. |
|
52 |
|
53 Also if a ProjectSurvey has been coupled to the GradingSurveyGroup this must |
|
54 be on record as well for the GradingRecord to state a pass, even if the |
|
55 Mentor has filled in a passing grade. |
|
56 """ |
|
57 |
|
58 #: The GradingSurveyGroup to which this record belongs |
|
59 grading_survey_group = db.ReferenceProperty( |
|
60 GradingSurveyGroup, required=True, collection_name='grading_records') |
|
61 |
|
62 #: Mentor's GradingProjectSurveyRecord for this evaluation. Iff exists. |
|
63 mentor_record = db.ReferenceProperty( |
|
64 GradingProjectSurveyRecord, required=False, |
|
65 collection_name='mentor_grading_records') |
|
66 |
|
67 #: Student's ProjectSurveyRecord for this evaluation. Iff exists. |
|
68 student_record = db.ReferenceProperty( |
|
69 ProjectSurveyRecord, required=False, |
|
70 collection_name='student_grading_records') |
|
71 |
|
72 #: Project for this evaluation. |
|
73 project = db.ReferenceProperty(StudentProject, |
|
74 collection_name='grading_records', |
|
75 required=True) |
|
76 |
|
77 #: Grade decision set for this grading record. |
|
78 #: pass: Iff the mentor_record states that the student has passed. |
|
79 #: And if a ProjectSurvey has been set in the GradingSurveyGroup |
|
80 #: then the student_record must be set as well. |
|
81 #: fail: If the mentor_record states that the student has failed. The |
|
82 #: student_record does not matter in this case. However if the mentor |
|
83 #: states that the student has passed, a ProjectSurvey has been |
|
84 #: set in the GradingSurveyGroup and the student_record property is not |
|
85 #: set the decision will be fail. |
|
86 #: undecided: If no mentor_record has been set. |
|
87 grade_decision = db.StringProperty(required=True, default='undecided', |
|
88 choices=['pass', 'fail', 'undecided']) |
|
89 |
|
90 #: Boolean that states if the grade_decision property has been locked |
|
91 #: This is to prevent an automatic update from a GradingSurveyGroup to |
|
92 #: overwrite the decision made by for example a Program Administrator. |
|
93 locked = db.BooleanProperty(required=True, default=False, |
|
94 verbose_name=ugettext('Grade Decision locked')) |
|
95 |
|
96 #: Property containing the date that this GradingRecord was created. |
|
97 created = db.DateTimeProperty(auto_now_add=True) |
|
98 |
|
99 #: Property containing the last date that this GradingRecord was modified. |
|
100 modified = db.DateTimeProperty(auto_now=True) |