app/soc/models/survey_record_group.py
changeset 2442 dd1f94c3594c
parent 2430 c9a5bf5ed3c5
child 2446 0cf8f034f52d
equal deleted inserted replaced
2441:a24b2b4af87d 2442:dd1f94c3594c
    24 ]
    24 ]
    25 
    25 
    26 
    26 
    27 from google.appengine.ext import db
    27 from google.appengine.ext import db
    28 
    28 
    29 from soc.models.survey_record import SurveyRecord
    29 from soc.models.survey_record import GradingProjectSurveyRecord
       
    30 from soc.models.survey_record import ProjectSurveyRecord
    30 import soc.models.user
    31 import soc.models.user
    31 
    32 
    32 
    33 
    33 class SurveyRecordGroup(db.Expando):
    34 class SurveyRecordGroup(db.Expando):
    34   """Because Mentors and Students take different surveys,
    35   """Explicitly group SurveyRecords with a common project.
       
    36 
       
    37   Because Mentors and Students take different surveys,
    35   we cannot simply link survey records by a common project and survey.
    38   we cannot simply link survey records by a common project and survey.
    36 
    39 
    37   Instead, we establish a SurveyRecordGroup.
    40   Instead, we establish a SurveyRecordGroup.
    38 
    41 
    39   A SurveyRecordGroup links a group of survey records with a common
    42   A SurveyRecordGroup links a group of survey records with a common
    42   This entity also includes the current project_status at its creation.
    45   This entity also includes the current project_status at its creation.
    43   This property is used as a filter in lookups and acts as a safeguard
    46   This property is used as a filter in lookups and acts as a safeguard
    44   against unpredictable behavior. 
    47   against unpredictable behavior. 
    45   """
    48   """
    46 
    49 
       
    50   # TODO Create SurveyGroup model that contains the two Surveys as to make
       
    51   # it possible to setup which surveys should be grouped.
       
    52 
    47   #: Mentor SurveyRecord for this evaluation.
    53   #: Mentor SurveyRecord for this evaluation.
    48   mentor_record = db.ReferenceProperty(SurveyRecord, required=False,
    54   mentor_record = db.ReferenceProperty(GradingProjectSurveyRecord, required=False,
    49                               collection_name='mentor_record_groups')
    55                               collection_name='mentor_record_groups')
    50 
    56 
    51   #: Student SurveyRecord for this evaluation.
    57   #: Student SurveyRecord for this evaluation.
    52   student_record = db.ReferenceProperty(SurveyRecord, required=False,
    58   student_record = db.ReferenceProperty(ProjectSurveyRecord, required=False,
    53                               collection_name='student_record_groups')
    59                               collection_name='student_record_groups')
    54 
    60 
    55   #: Project for this evaluation.
    61   #: Project for this evaluation.
    56   project = db.ReferenceProperty(soc.models.student_project.StudentProject,
    62   project = db.ReferenceProperty(soc.models.student_project.StudentProject,
    57                                 collection_name="survey_record_groups",
    63                                 collection_name="survey_record_groups",