app/soc/logic/models/survey_record.py
changeset 2443 2e86dbd47907
parent 2442 dd1f94c3594c
child 2446 0cf8f034f52d
equal deleted inserted replaced
2442:dd1f94c3594c 2443:2e86dbd47907
    80     # if creating evaluation record, set SurveyRecordGroup
    80     # if creating evaluation record, set SurveyRecordGroup
    81     db.put(survey_record)
    81     db.put(survey_record)
    82     return survey_record
    82     return survey_record
    83 
    83 
    84 
    84 
       
    85 class ProjectLogic(Logic):
       
    86   """Logic class for ProjectSurveyRecord.
       
    87   """
       
    88 
       
    89   def __init__(self, model=ProjectSurveyRecord,
       
    90                base_model=None, scope_logic=None):
       
    91     """Defines the name, key_name and model for this entity.
       
    92     """
       
    93 
       
    94     super(Logic, self).__init__(model=model, base_model=base_model,
       
    95                                 scope_logic=scope_logic)
       
    96 
       
    97 
       
    98 class GradingProjectLogic(ProjectLogic):
       
    99   """Logic class for GradingProjectSurveyRecord
       
   100   """
       
   101 
       
   102   def __init__(self, model=GradingProjectSurveyRecord,
       
   103                base_model=None, scope_logic=None):
       
   104     """Defines the name, key_name and model for this entity.
       
   105     """
       
   106 
       
   107     super(Logic, self).__init__(model=model, base_model=base_model,
       
   108                                 scope_logic=scope_logic)
       
   109 
       
   110 
    85 logic = Logic()
   111 logic = Logic()
    86 # TODO separate project and grading logic into own class to overwrite methods
   112 project_logic = ProjectLogic()
    87 project_logic = Logic(model=ProjectSurveyRecord)
   113 grading_logic = GradingProjectLogic()
    88 grading_logic = Logic(model=GradingProjectSurveyRecord)
       
    89 
   114 
    90 
   115 
    91 def updateSurveyRecord(user, survey, survey_record, fields):
   116 def updateSurveyRecord(user, survey, survey_record, fields):
    92   """Create a new survey record, or get an existing one.
   117   """Create a new survey record, or get an existing one.
    93 
   118