app/soc/views/models/organization.py
changeset 2296 ebc4931f0762
parent 2283 f92942dfc28f
child 2331 91379f6b8fcb
equal deleted inserted replaced
2295:8566fb2b8012 2296:ebc4931f0762
   420 
   420 
   421     return self._list(request, params, contents, page_name)
   421     return self._list(request, params, contents, page_name)
   422 
   422 
   423   def _getMapData(self, student_project_params, filter=None):
   423   def _getMapData(self, student_project_params, filter=None):
   424     """Constructs the JSON object required to generate a 
   424     """Constructs the JSON object required to generate a 
   425       google map on organization home page.
   425       Google map on organization home page.
   426 
   426 
   427     Args:
   427     Args:
   428       student_project_logic: logic for student_project to obtain entities
   428       student_project_params: params for student project view
   429       filter: a dict for the properties that the entities should have
   429       filter: a dict for the properties that the entities should have
   430 
   430 
   431     Returns: 
   431     Returns: 
   432       A json object containing map data with the following structure.
   432       A JSON object containing map data with the following structure.
   433       [
   433       [
   434         {
   434         {
   435           'type': 'mentor',
   435           'type': 'mentor',
   436           'name': MentorName,
   436           'name': MentorName,
   437           'city': CityName,
   437           'city': CityName,
   447           'student': {'name': Name, 'city': CityName, 'ccTLD': ccTLD, 
   447           'student': {'name': Name, 'city': CityName, 'ccTLD': ccTLD, 
   448                       'summary': Summary, 'url': URL}
   448                       'summary': Summary, 'url': URL}
   449         }
   449         }
   450       ]
   450       ]
   451     """
   451     """
   452     student_project_logic = student_project_params['logic']
   452 
       
   453     from soc.logic.models.student_project import logic as student_project_logic
   453 
   454 
   454     map_data = []
   455     map_data = []
   455     mentors = {}
   456     mentors = {}
   456     student_only = []
   457     student_only = []
   457 
   458 
   458     # get all the student_project entities for this organization
   459     # get all the student_project entities for this organization
   459     student_project_entities = student_project_logic.getForFields(filter)
   460     student_project_entities = student_project_logic.getForFields(filter=filter)
   460 
   461 
   461     # construct a dictionary of mentors. For each mentor construct a
   462     # construct a dictionary of mentors. For each mentor construct a
   462     # list of 3-tuple containing student, project title and url. This is
   463     # list of 3-tuple containing student, project title and url. This is
   463     # mainly done to track and pair all students and mentors who
   464     # mainly done to track and pair all students and mentors who
   464     # have allowed to publish their locations.
   465     # have allowed to publish their locations.