Example #1
0
def convertCIOrganization(org_key):
    """Converts the specified Code In organization by creating a new
  organization entity that inherits from NDB model.

  Args:
    org_key: Organization key.
  """
    organization = GCIOrganization.get(org_key)

    entity_id = '%s/%s' % (organization.program.key().name(),
                           organization.link_id)

    org_properties = {}
    org_properties.update(_generalProperties(organization))
    org_properties.update(_ciSpecificProperties(organization))
    new_organization = ci_org_model.CIOrganization(id=entity_id,
                                                   **org_properties)
    to_put = [new_organization]

    # find organization application record corresponding to this organization
    app_record = OrgAppRecord.all().filter('org_id',
                                           organization.link_id).filter(
                                               'program',
                                               organization.program).get()
    if app_record:
        to_put.append(_convertSurveyResponse(app_record, new_organization))

    persistEntitiesTxn(to_put)
    operation.counters.Increment('Organizations converted')
def convertCIOrganization(org_key):
  """Converts the specified Code In organization by creating a new
  organization entity that inherits from NDB model.

  Args:
    org_key: Organization key.
  """
  organization = GCIOrganization.get(org_key)

  entity_id = '%s/%s' % (
      organization.program.key().name(), organization.link_id)

  org_properties = {}
  org_properties.update(_generalProperties(organization))
  org_properties.update(_ciSpecificProperties(organization))
  new_organization = ci_org_model.CIOrganization(
      id=entity_id, **org_properties)
  to_put = [new_organization]

  # find organization application record corresponding to this organization
  app_record = OrgAppRecord.all().filter(
      'org_id', organization.link_id).filter(
          'program', organization.program).get()
  if app_record:
    to_put.append(_convertSurveyResponse(app_record, new_organization))

  persistEntitiesTxn(to_put)
  operation.counters.Increment('Organizations converted')
Example #3
0
def convertGCIOrg(org_key):
  """Converts the specified organization by changing values of its profile
  related properties to the new NDB based profile entities.

  Args:
    org_key: Organization key.
  """
  org = GCIOrganization.get(org_key)
  org.proposed_winners = _convertListProperty(
      GCIOrganization.proposed_winners, org)
  org.backup_winner = _convertReferenceProperty(
      GCIOrganization.backup_winner, org)
  org.put()
Example #4
0
def convertGCIOrg(org_key):
    """Converts the specified organization by changing values of its profile
  related properties to the new NDB based profile entities.

  Args:
    org_key: Organization key.
  """
    org = GCIOrganization.get(org_key)
    org.proposed_winners = _convertListProperty(
        GCIOrganization.proposed_winners, org)
    org.backup_winner = _convertReferenceProperty(
        GCIOrganization.backup_winner, org)
    org.put()