Example #1
0
  def getListData(self):
    idx = lists.getListIndex(self.request)
    if idx != 0:
      return None

    org = self.data.organization
    program = self.data.program

    # Hold all the accepted projects for orgs where this user is a member of
    accepted = []
    # Hold all duplicates for either the entire program or the orgs of the user.
    duplicates = []
    dupQ = GSoCProposalDuplicate.all()
    dupQ.filter('is_duplicate', True)
    dupQ.filter('org', org)
    dupQ.filter('program', program)

    accepted.extend([p.key() for p in getProposalsToBeAcceptedForOrg(org)])

    duplicate_entities = dupQ.fetch(1000)
    for dup in duplicate_entities:
      duplicates.extend(dup.duplicates)

    q = GSoCProposal.all()
    q.filter('org', org)
    q.filter('program', program)

    starter = lists.keyStarter
    prefetcher = lists.modelPrefetcher(GSoCProposal, ['org'], parent=True)

    response_builder = lists.RawQueryContentResponseBuilder(
        self.request, self._list_config, q, starter, prefetcher=prefetcher)
    return response_builder.build(accepted, duplicates)
Example #2
0
  def getListData(self):
    idx = lists.getListIndex(self.request)
    if idx != 0:
      return None

    q = GSoCSlotTransfer.all().filter('program', self.data.program)

    starter = lists.keyStarter
    prefetcher = lists.modelPrefetcher(GSoCSlotTransfer, [], parent=True)

    response_builder = lists.RawQueryContentResponseBuilder(
        self.request, self._list_config, q, starter, prefetcher=prefetcher)

    return response_builder.build()
Example #3
0
  def listContent(self):
    """Returns the ListContentResponse object that is constructed from the data.
    """
    q = GSoCGradingRecord.all()
    q.filter('grading_survey_group', self.data.survey_group)

    starter = lists.keyStarter
    prefetcher = lists.modelPrefetcher(
        GSoCGradingRecord, ['mentor_record', 'student_record'], parent=True)

    response_builder = lists.RawQueryContentResponseBuilder(
        self.request, self._list_config, q,
        starter, prefetcher=prefetcher)
    return response_builder.build()
Example #4
0
  def getListData(self):
    idx = lists.getListIndex(self.request)
    if idx == self.LEADERBOARD_LIST_IDX:
      q = GCIScore.all()
      q.filter('program', self.data.program)

      skipper = lambda entity, start: entity.points <= 0
      prefetcher = lists.modelPrefetcher(GCIScore, [], True)

      response_builder = lists.RawQueryContentResponseBuilder(self.request,
          self._list_config, q, lists.keyStarter,
          skipper=skipper, prefetcher=prefetcher)

      return response_builder.build()
    else:
      return None
Example #5
0
    def getListData(self):
        """Returns the list data as requested by the current request.

    If the lists as requested is not supported by this component None is
    returned.
    """
        idx = lists.getListIndex(self.request)
        if idx == 0:
            list_query = project_logic.getProjectsQuery(program=self.data.program)

            starter = lists.keyStarter
            prefetcher = lists.modelPrefetcher(GSoCProject, ["org"], parent=True)

            response_builder = lists.RawQueryContentResponseBuilder(
                self.request, self._list_config, list_query, starter, prefetcher=prefetcher
            )
            return response_builder.build()
        else:
            return None
Example #6
0
  def listContentResponse(self, request, prefetch=[]):
    """Returns the ListContentResponse object that is constructed from the data.

    Args:
      request: The Django request object.
      prefetch: List of fields to prefetch for increased performance.
    """
    q = self.record_model.all()
    q.filter('survey', self.survey)

    starter = lists.keyStarter

    if prefetch:
      prefetcher = lists.modelPrefetcher(self.record_model, prefetch)
    else:
      prefetcher = None

    response_builder = lists.RawQueryContentResponseBuilder(
        request, self.list_config, q, starter, prefetcher=prefetcher)
    return response_builder.build()