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