From 2a5778bfe4c728ec071d627efa77fe18f5bc55f0 Mon Sep 17 00:00:00 2001 From: Angelina Tingaeva Date: Wed, 6 Dec 2023 13:50:09 +0500 Subject: [PATCH] fix(mapping): check gid in task --- mapping.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mapping.py b/mapping.py index 38ed277..4b51aa1 100644 --- a/mapping.py +++ b/mapping.py @@ -56,8 +56,7 @@ def get_parent_task_ids(task, ya_imported_task_response): parent_task_ids = {} - # for task in data["data"]: - if task.get('parent') and 'gid' in task['parent']: + if task.get('parent') and 'gid' in task['parent'] and task['gid'] in ya_imported_task_response: parent_gid = task['parent']['gid'] if parent_gid in ya_imported_task_response: parent_id = ya_imported_task_response[parent_gid] @@ -102,8 +101,8 @@ def create_tasks_in_tracker(data): ya_imported_task_response = {} for task in data: - if 'gid' not in task: - continue # check gid existing + # if 'gid' not in task: + # continue # check gid existing if task.get('assignee') and 'gid' in task['assignee']: ya_assignee = assignee.get(task['assignee']['gid'], 'dr.cyrill') @@ -133,7 +132,8 @@ def create_tasks_in_tracker(data): print('Задача успешно создана в ЯндексТрекер') # здесь добавлено про родительскую задачу - ya_imported_task_response[task['gid']] = response.json()['id'] + if 'gid' in task: + ya_imported_task_response[task['gid']] = response.json()['id'] else: print( 'Ошибка при создании задачи в ЯндексТрекер:',