app/soc/logic/models/survey.py
changeset 2460 b8b0c631bcfe
parent 2459 accd8ba94b44
child 2462 2d5d2961f774
equal deleted inserted replaced
2459:accd8ba94b44 2460:b8b0c631bcfe
   170     elif survey.taking_access == 'student evaluation':
   170     elif survey.taking_access == 'student evaluation':
   171       survey_record_group.student_record = survey_record
   171       survey_record_group.student_record = survey_record
   172 
   172 
   173     return survey_record_group
   173     return survey_record_group
   174 
   174 
       
   175   def getSurveyForContent(self, survey_content):
       
   176     """Returns the Survey belonging to the given SurveyContent.
       
   177 
       
   178     params:
       
   179       survey_content: the SurveyContent to retrieve the Survey for.
       
   180 
       
   181     returns:
       
   182       Survey or subclass if possible else None.
       
   183     """
       
   184 
       
   185     fields = {'survey_content': survey_content}
       
   186 
       
   187     return self.getForFields(fields, unique=True)
       
   188 
   175   def getUserRole(self, user, survey, project):
   189   def getUserRole(self, user, survey, project):
   176     """Gets the role of a user for a project, used for SurveyRecordGroup.
   190     """Gets the role of a user for a project, used for SurveyRecordGroup.
   177 
   191 
   178     params:
   192     params:
   179       user: user taking survey
   193       user: user taking survey