Beispiel #1
0
def convertGCIProfileDBEntityGroup(profile_key):
  """Converts DB based part of entity group associated with the specified
  profile.

  Args:
    profile_key: db.Key of the profile to process.
  """
  to_delete = []
  do_put = True

  org_scores = GCIOrgScore.all().ancestor(profile_key).fetch(1000)
  for org_score in org_scores:
    new_org_score = _convertParent(org_score)
    if do_put:
      new_org_score.put()
    to_delete.append(org_score)

  scores = GCIScore.all().ancestor(profile_key).fetch(1000)
  for score in scores:
    new_score = _convertParent(score)
    if do_put:
      new_score.put()
    to_delete.append(score)

  db.delete(to_delete)
Beispiel #2
0
def convertGCIProfileDBEntityGroup(profile_key):
    """Converts DB based part of entity group associated with the specified
  profile.

  Args:
    profile_key: db.Key of the profile to process.
  """
    to_delete = []
    do_put = True

    org_scores = GCIOrgScore.all().ancestor(profile_key).fetch(1000)
    for org_score in org_scores:
        new_org_score = _convertParent(org_score)
        if do_put:
            new_org_score.put()
        to_delete.append(org_score)

    scores = GCIScore.all().ancestor(profile_key).fetch(1000)
    for score in scores:
        new_score = _convertParent(score)
        if do_put:
            new_score.put()
        to_delete.append(score)

    db.delete(to_delete)
Beispiel #3
0
  def getListData(self):
    idx = lists.getListIndex(self.data.request)
    if idx == self.ORG_SCORE_LIST_IDX:
      q = GCIOrgScore.all()
      q.filter('org', self.data.organization)

      skipper = lambda entity, start: entity.numberOfTasks() <= 0

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

      return response_builder.build()
    else:
      return None
Beispiel #4
0
    def getListData(self):
        idx = lists.getListIndex(self.data.request)
        if idx == self.ORG_SCORE_LIST_IDX:
            q = GCIOrgScore.all()
            q.filter('org', self.data.organization)

            skipper = lambda entity, start: entity.numberOfTasks() <= 0

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

            return response_builder.build()
        else:
            return None
Beispiel #5
0
def queryForAncestor(ancestor, keys_only=False):
  """Returns the query to fetch OrgScore entities for the specified
  ancestor.
  """
  return GCIOrgScore.all(keys_only=keys_only).ancestor(ancestor)
Beispiel #6
0
def queryForAncestorAndOrg(ancestor, org, keys_only=False):
  """Returns the query to fetch OrgScore entities for the specified
  ancestor and organization.
  """
  return GCIOrgScore.all(keys_only=keys_only).ancestor(
      ancestor).filter('org', org)
Beispiel #7
0
def queryForOrg(org, keys_only=False):
  """Return the query to fetch OrgScore entities for the specified
  organization.
  """
  return GCIOrgScore.all(keys_only=keys_only).filter('org', org)
Beispiel #8
0
def queryForAncestor(ancestor, keys_only=False):
    """Returns the query to fetch OrgScore entities for the specified
  ancestor.
  """
    return GCIOrgScore.all(keys_only=keys_only).ancestor(ancestor)
Beispiel #9
0
def queryForAncestorAndOrg(ancestor, org, keys_only=False):
    """Returns the query to fetch OrgScore entities for the specified
  ancestor and organization.
  """
    return GCIOrgScore.all(keys_only=keys_only).ancestor(ancestor).filter(
        'org', org)
Beispiel #10
0
def queryForOrg(org, keys_only=False):
    """Return the query to fetch OrgScore entities for the specified
  organization.
  """
    return GCIOrgScore.all(keys_only=keys_only).filter('org', org)