fix(mapping): check gid in task
This commit is contained in:
parent
10eadc8a95
commit
2a5778bfe4
10
mapping.py
10
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(
|
||||
'Ошибка при создании задачи в ЯндексТрекер:',
|
||||
|
Loading…
Reference in New Issue
Block a user