예제 #1
0
def remove_dos4_answers(api_client: DataAPIClient, draft: dict,
                        developer_email: str) -> dict:
    print(f"Supplier id: {draft['supplierId']}")
    print(f"Draft id: {draft['id']}")

    return api_client.update_draft_service(
        draft['id'], {
            "agileCoachPriceMin": None,
            "businessAnalystPriceMin": None,
            "communicationsManagerPriceMin": None,
            "contentDesignerPriceMin": None,
            "dataArchitectPriceMin": None,
            "dataEngineerPriceMin": None,
            "dataScientistPriceMin": None,
            "deliveryManagerPriceMin": None,
            "designerPriceMin": None,
            "developerPriceMin": None,
            "performanceAnalystPriceMin": None,
            "portfolioManagerPriceMin": None,
            "productManagerPriceMin": None,
            "programmeManagerPriceMin": None,
            "qualityAssurancePriceMin": None,
            "securityConsultantPriceMin": None,
            "serviceManagerPriceMin": None,
            "technicalArchitectPriceMin": None,
            "userResearcherPriceMin": None,
            "webOperationsPriceMin": None,
            "developerAccessibleApplications": None,
            "contentDesignerAccessibleApplications": None,
            "qualityAssuranceAccessibleApplications": None,
            "technicalArchitectAccessibleApplications": None,
            "webOperationsAccessibleApplications": None,
            "serviceManagerAccessibleApplications": None,
            "designerAccessibleApplications": None
        }, developer_email)
예제 #2
0
    api_url = get_api_endpoint_from_stage(stage)
    client = DataAPIClient(api_url, api_token)

    counter = 0
    for draft in get_all_drafts(client):
        update = {}
        if "outcomesLocations" in draft:
            update["locations"] = draft["outcomesLocations"]
            update["outcomesLocations"] = None
        if "recruitLocations" in draft:
            if update:
                raise ValueError(
                    "draft {} has both outcomesLocations and recruitLocations".
                    format(draft["id"]))
            update["locations"] = draft["recruitLocations"]
            update["recruitLocations"] = None

        if update:
            counter += 1

            update_reason = "rename locations: https://www.pivotaltracker.com/story/show/113271913"
            if dry_run:
                print("{} {}".format(draft["id"], update))
            else:
                client.update_draft_service(draft["id"], update, update_reason)

            if counter % 10 == 0:
                print("Updated {}".format(counter))

    print("DONE: {}".format(counter))
예제 #3
0
    return itertools.chain.from_iterable(
        pool.imap_unordered(create_draft_getter(client),
                            client.find_suppliers_iter()))


def get_location(location):
    return NEW_LOCATION if location == OLD_LOCATION else location


if __name__ == '__main__':
    arguments = docopt(__doc__)

    stage = arguments['<stage>']
    dry_run = arguments['--dry-run']

    api_url = get_api_endpoint_from_stage(stage)
    client = DataAPIClient(api_url, get_auth_token('api', stage))

    counter = 0
    for draft in get_all_drafts(client):
        for location_key in get_location_keys(draft):
            draft[location_key] = [
                get_location(location) for location in draft[location_key]
            ]
        counter += 1
        if not dry_run:
            client.update_draft_service(draft['id'], draft, "script",
                                        list(draft.keys()))

    print("Updated {}".format(counter))
    dry_run = arguments['--dry-run']

    api_url = get_api_endpoint_from_stage(stage)
    client = DataAPIClient(api_url, api_token)

    counter = 0
    for draft in get_all_drafts(client):
        update = {}
        if "outcomesLocations" in draft:
            update["locations"] = draft["outcomesLocations"]
            update["outcomesLocations"] = None
        if "recruitLocations" in draft:
            if update:
                raise ValueError("draft {} has both outcomesLocations and recruitLocations".format(draft["id"]))
            update["locations"] = draft["recruitLocations"]
            update["recruitLocations"] = None

        if update:
            counter += 1

            update_reason = "rename locations: https://www.pivotaltracker.com/story/show/113271913"
            if dry_run:
                print("{} {}".format(draft["id"], update))
            else:
                client.update_draft_service(draft["id"], update, update_reason)

            if counter % 10 == 0:
                print("Updated {}".format(counter))

    print("DONE: {}".format(counter))
        create_draft_getter(client),
        client.find_suppliers_iter()
    ))


def get_location(location):
    return NEW_LOCATION if location == OLD_LOCATION else location


if __name__ == '__main__':
    arguments = docopt(__doc__)

    stage = arguments['<stage>']
    api_token = arguments['<api_token>']
    dry_run = arguments['--dry-run']

    api_url = get_api_endpoint_from_stage(stage)
    client = DataAPIClient(api_url, api_token)

    counter = 0
    for draft in get_all_drafts(client):
        for location_key in get_location_keys(draft):
            draft[location_key] = [
                get_location(location) for location in draft[location_key]
            ]
        counter += 1
        if not dry_run:
            client.update_draft_service(draft['id'], draft, "script", list(draft.keys()))

    print("Updated {}".format(counter))