Added skeleton models for GradingSurveyGroup and Records.
authorLennard de Rijk <ljvderijk@gmail.com>
Tue, 07 Jul 2009 18:46:47 +0200
changeset 2567 0162efa63bb6
parent 2566 03ea1e3be104
child 2568 5c456c4d0a0b
Added skeleton models for GradingSurveyGroup and Records. SurveyRecordGroup has been renamed to GradingRecord. GradingSurveyGroup will hold which Surveys should be linked. While the acompanying GradingRecords (with their reference to a GradingSurveyGroup) will hold the Records for each StudentProject that can take these Surveys.
app/soc/models/grading_record.py
app/soc/models/grading_survey_group.py
app/soc/models/survey_record_group.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/models/grading_record.py	Tue Jul 07 18:46:47 2009 +0200
@@ -0,0 +1,100 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""GradingRecord represents a cluster (mentor/student) of SurveyRecords
+for an evaluation period.
+"""
+
+__authors__ = [
+  '"Daniel Diniz" <ajaksu@gmail.com>',
+  '"James Levy" <jamesalexanderlevy@gmail.com>',
+  '"Lennard de Rijk" <ljvderijk@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+from soc.models import base
+from soc.models.grading_project_survey_record import GradingProjectSurveyRecord
+from soc.models.grading_survey_group import GradingSurveyGroup
+from soc.models.project_survey_record import ProjectSurveyRecord
+from soc.models.student_project import StudentProject
+
+
+class GradingRecord(base.ModelWithFieldAttributes):
+  """Explicitly group SurveyRecords with a common project.
+
+  Because Mentors and Students take different surveys,
+  we cannot simply link survey records by a common project and survey.
+
+  Instead, we establish a GradingRecord.
+
+  A GradingRecord links a group of survey records with a common
+  project, and links back to its records.
+
+  This entity can be edited by Program Administrators to edit the outcome
+  of a the Grading surveys without touching the real survey's answers.
+
+  Also if a ProjectSurvey has been coupled to the GradingSurveyGroup this must
+  be on record as well for the GradingRecord to state a pass, even if the
+  Mentor has filled in a passing grade.
+  """
+
+  #: The GradingSurveyGroup to which this record belongs
+  grading_survey_group = db.ReferenceProperty(
+      GradingSurveyGroup, required=True, collection_name='grading_records')
+
+  #: Mentor's GradingProjectSurveyRecord for this evaluation. Iff exists.
+  mentor_record = db.ReferenceProperty(
+      GradingProjectSurveyRecord, required=False,
+      collection_name='mentor_grading_records')
+
+  #: Student's ProjectSurveyRecord for this evaluation. Iff exists.
+  student_record = db.ReferenceProperty(
+      ProjectSurveyRecord, required=False,
+      collection_name='student_grading_records')
+
+  #: Project for this evaluation.
+  project = db.ReferenceProperty(StudentProject,
+                                collection_name='grading_records',
+                                required=True)
+
+  #: Grade decision set for this grading record.
+  #: pass: Iff the mentor_record states that the student has passed. 
+  #:       And if a ProjectSurvey has been set in the GradingSurveyGroup
+  #:       then the student_record must be set as well.
+  #: fail: If the mentor_record states that the student has failed. The
+  #:       student_record does not matter in this case. However if the mentor
+  #:       states that the student has passed, a ProjectSurvey has been
+  #:       set in the GradingSurveyGroup and the student_record property is not
+  #:       set the decision will be fail.
+  #: undecided: If no mentor_record has been set.
+  grade_decision = db.StringProperty(required=True, default='undecided',
+      choices=['pass', 'fail', 'undecided'])
+
+  #: Boolean that states if the grade_decision property has been locked
+  #: This is to prevent an automatic update from a GradingSurveyGroup to
+  #: overwrite the decision made by for example a Program Administrator.
+  locked = db.BooleanProperty(required=True, default=False,
+                              verbose_name=ugettext('Grade Decision locked'))
+
+  #: Property containing the date that this GradingRecord was created.
+  created = db.DateTimeProperty(auto_now_add=True)
+
+  #: Property containing the last date that this GradingRecord was modified.
+  modified = db.DateTimeProperty(auto_now=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/models/grading_survey_group.py	Tue Jul 07 18:46:47 2009 +0200
@@ -0,0 +1,69 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""GradingSurveyGroup has the ability to link a GradingProjectSurvey to a
+ProjectSurvey for evaluation purposes.
+"""
+
+__authors__ = [
+  '"Lennard de Rijk" <ljvderijk@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+from soc.models import linkable
+from soc.models.grading_project_survey import GradingProjectSurvey
+from soc.models.project_survey import ProjectSurvey
+
+
+class GradingSurveyGroup(linkable.Linkable):
+  """The GradingSurveyGroups links a ProjectSurvey with a GradingProjectSurvey.
+
+  The purpose of this model is to be able to link two different types of
+  Surveys together so that a decision can be made about whether or not a
+  Student has passed the evaluation. This model will link the Surveys together
+  a GradingRecord will link the SurveyRecords.
+
+  Since this model is only used in GSoC style programs the scope will be set to
+  a Program entity. The link_id can be auto-generated.
+
+  A GradingSurvey group can also work with only a GradingProjectSurvey defined.
+
+  The GradingSurveyGroup can have several GradingRecords attached to it. These
+  will contain matching SurveyRecords for the surveys set in this group, of
+  course only if they are filled in.
+  """
+
+  #: GradingProjectSurvey which belongs to this group.
+  grading_survey = db.ReferenceProperty(
+      GradingProjectSurvey, required=True,
+      collection_name='grading_survey_groups')
+
+  #: non-required ProjectSurvey that belongs to this group.
+  student_survey = db.ReferenceProperty(
+      ProjectSurvey, required=False,
+      collection_name='project_survey_groups')
+
+  #: DateTime when the last GradingRecord update was started for this group.
+  last_update_started = db.DateTimeProperty(
+      verbose_name=ugettext('Last Record update started'))
+
+  #: DateTime when the last GradingRecord update was completed for this group.
+  last_update_complete = db.DateTimeProperty(
+      verbose_name=ugettext('Last Record update completed'))
--- a/app/soc/models/survey_record_group.py	Mon Jul 06 17:20:30 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/usr/bin/python2.5
-#
-# Copyright 2009 the Melange authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""SurveyRecordGroup represents a cluster (mentor/student) of SurveyRecords
-for an evaluation period.
-"""
-
-__authors__ = [
-  '"Daniel Diniz" <ajaksu@gmail.com>',
-  '"James Levy" <jamesalexanderlevy@gmail.com>',
-]
-
-
-from google.appengine.ext import db
-
-from soc.models.grading_project_survey_record import GradingProjectSurveyRecord
-from soc.models.project_survey_record import ProjectSurveyRecord
-import soc.models.user
-
-
-class SurveyRecordGroup(db.Expando):
-  """Explicitly group SurveyRecords with a common project.
-
-  Because Mentors and Students take different surveys,
-  we cannot simply link survey records by a common project and survey.
-
-  Instead, we establish a SurveyRecordGroup.
-
-  A SurveyRecordGroup links a group of survey records with a common
-  project, and links back to its records. 
-
-  This entity also includes the current project_status at its creation.
-  This property is used as a filter in lookups and acts as a safeguard
-  against unpredictable behavior. 
-  """
-
-  # TODO Create SurveyGroup model that contains the two Surveys as to make
-  # it possible to setup which surveys should be grouped.
-
-  #: Mentor SurveyRecord for this evaluation.
-  mentor_record = db.ReferenceProperty(GradingProjectSurveyRecord,
-                                       required=False,
-                                       collection_name='mentor_record_groups')
-
-  #: Student SurveyRecord for this evaluation.
-  student_record = db.ReferenceProperty(
-      ProjectSurveyRecord, required=False,
-      collection_name='student_record_groups')
-
-  #: Project for this evaluation.
-  project = db.ReferenceProperty(soc.models.student_project.StudentProject,
-                                collection_name="survey_record_groups",
-                                required=True)
-
-  # Status of project at start of evaluation.
-  initial_status = db.StringProperty(required=True)
-
-  #: Status of project at end of evaluation.
-  final_status = db.StringProperty(required=False)
-
-  #: Property containing the date that this SurveyRecordGroup was created.
-  created = db.DateTimeProperty(auto_now_add=True)
-
-  #: Property containing the last date that this SurveyRecordGroup was modified.
-  modified = db.DateTimeProperty(auto_now=True)