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( 'Ошибка при создании задачи в ЯндексТрекер:',