Fix finding attribute and task ids
This commit is contained in:
parent
55c15da039
commit
402bf0445b
10
importer.py
10
importer.py
|
@ -243,6 +243,7 @@ def generate_taiga_userstory(link):
|
|||
username=CONFIG["taiga"]["username"],
|
||||
password=CONFIG["taiga"]["password"]
|
||||
)
|
||||
global proj
|
||||
proj = api.projects.get_by_slug(CONFIG["taiga"]["project_slug"])
|
||||
|
||||
# Create userstory for printable
|
||||
|
@ -253,14 +254,13 @@ def generate_taiga_userstory(link):
|
|||
|
||||
# Set custom field for platform link if enabled and configured
|
||||
if bool(CONFIG["taiga"]["userstory_use_custom_field"]):
|
||||
us_attributes = list(map(lambda x: {"id": x.id, "name": x.name}, api.user_story_attributes.list()))
|
||||
attribute_id = list(filter(lambda x: CONFIG["taiga"]["userstory_custom_field_name"] in x["name"], us_attributes))[0]["id"]
|
||||
us_attributes = list(map(lambda x: {"id": x.id, "name": x.name, "project": x.project}, api.user_story_attributes.list()))
|
||||
attribute_id = list(filter(lambda x: CONFIG["taiga"]["userstory_custom_field_name"] in x["name"] and x["project"] == proj.id, us_attributes))[0]["id"]
|
||||
story.set_attribute(attribute_id, link)
|
||||
|
||||
# Find id for desired status of newly tasks
|
||||
task_statuses = list(map(lambda x: {"id": x.id, "name": x.name}, api.task_statuses.list()))
|
||||
task_status_id = list(filter(lambda x: CONFIG["taiga"]["initial_task_status"] == x["name"], task_statuses))[0]["id"]
|
||||
|
||||
task_statuses = list(map(lambda x: {"id": x.id, "name": x.name, "project": x.project}, api.task_statuses.list()))
|
||||
task_status_id = list(filter(lambda x: CONFIG["taiga"]["initial_task_status"] == x["name"] and x["project"] == proj.id, task_statuses))[0]["id"]
|
||||
|
||||
tmpdir = tempfile.TemporaryDirectory() #workdir for downloads
|
||||
|
||||
|
|
Loading…
Reference in a new issue