chore: merge commits

This commit is contained in:
cyrill 2023-12-01 12:13:34 +05:00
commit 98c09a6f9c

View File

@ -2,7 +2,7 @@ import csv
import json import json
import os import os
import sys import sys
import logging # import logging
import requests import requests
@ -47,6 +47,7 @@ def get_assignee_data():
mapping[asana_id] = ya_login mapping[asana_id] = ya_login
return mapping return mapping
assignee = get_assignee_data() assignee = get_assignee_data()
@ -114,6 +115,7 @@ def create_tasks_in_tracker(data):
# 'completedAt': task['completedAt'] # 'completedAt': task['completedAt']
} }
logger.debug('Request: %s', json.dumps(payload)) logger.debug('Request: %s', json.dumps(payload))
response = requests.post( response = requests.post(
@ -129,8 +131,32 @@ def create_tasks_in_tracker(data):
'Ошибка при создании задачи в ЯндексТрекер:', 'Ошибка при создании задачи в ЯндексТрекер:',
response.content, response.content,
) )
logger.debug('Response: %s', response.content) logger.debug('Response: %s', response.content)
ya_imported_task_response = response.json()
if task.get('parent'):
parent_task_gid = task['parent']['gid']
if parent_task_gid in ya_imported_task_response:
parent_task_id = ya_imported_task_response[parent_task_gid]['id']
update_parent_task(
base_url,
headers,
ya_imported_task_response['id'],
parent_task_id,
)
def update_parent_task(base_url, headers, task_id, parent_task_id):
""" Обновление данных родительской задачи в ЯндексТрекере"""
payload = {
'parent': parent_task_id
}
update_url = f"{base_url}/{task_id}"
# asana_data = get_data_from_asana() # asana_data = get_data_from_asana()
file = open(asana_data_json, "r", encoding="utf8") file = open(asana_data_json, "r", encoding="utf8")
json_data = json.loads(file.read()) json_data = json.loads(file.read())