fix(core): a set of data inconsistencies and minor bugs
This commit is contained in:
parent
c7cd5dbd1b
commit
fe39119518
1146
data/data_asana.json
1146
data/data_asana.json
File diff suppressed because one or more lines are too long
11
mapping.py
11
mapping.py
@ -74,6 +74,7 @@ def transform_data(data):
|
||||
for task in data["data"]:
|
||||
status, completed_at = get_task_status(task)
|
||||
transformed_task = {
|
||||
'gid':task['gid'],
|
||||
'summary': task['name'],
|
||||
'description': task['notes'],
|
||||
'createdAt': task['created_at'],
|
||||
@ -98,7 +99,7 @@ def create_tasks_in_tracker(data, limit=10):
|
||||
'X-Org-ID': '7095769',
|
||||
'Content-Type': 'appication/json',
|
||||
}
|
||||
datalen = min(limit, len(data))
|
||||
datalen = (len(data) if limit==-1 else min(limit, len(data)))
|
||||
logger.info('Import started. Task count: %d', datalen)
|
||||
|
||||
# этот датасет тоже для parent добавлен
|
||||
@ -136,9 +137,13 @@ def create_tasks_in_tracker(data, limit=10):
|
||||
print('Задача успешно создана в ЯндексТрекер')
|
||||
|
||||
# здесь добавлено про родительскую задачу
|
||||
|
||||
if 'gid' in task:
|
||||
ya_imported_task_response[task['gid']] = response.json()['id']
|
||||
assign_parent_task(response.json()['id'], task['parent']['gid'])
|
||||
logger.info('Got respnse for asana task gid = %s: ya.task.id = %s',task['gid'],ya_imported_task_response[task['gid']])
|
||||
|
||||
if task['parent'] is not None:
|
||||
assign_parent_task(ya_imported_task_response[task['gid']], task['parent']['gid'])
|
||||
|
||||
else:
|
||||
print(
|
||||
@ -194,4 +199,4 @@ file = open(asana_data_json, "r", encoding="utf8")
|
||||
json_data = json.loads(file.read())
|
||||
|
||||
yandex_tracker_data = transform_data(json_data)
|
||||
create_tasks_in_tracker(yandex_tracker_data, limit=10)
|
||||
create_tasks_in_tracker(yandex_tracker_data, limit=3)
|
||||
|
Loading…
Reference in New Issue
Block a user