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"],
|
username=CONFIG["taiga"]["username"],
|
||||||
password=CONFIG["taiga"]["password"]
|
password=CONFIG["taiga"]["password"]
|
||||||
)
|
)
|
||||||
|
global proj
|
||||||
proj = api.projects.get_by_slug(CONFIG["taiga"]["project_slug"])
|
proj = api.projects.get_by_slug(CONFIG["taiga"]["project_slug"])
|
||||||
|
|
||||||
# Create userstory for printable
|
# Create userstory for printable
|
||||||
|
@ -253,14 +254,13 @@ def generate_taiga_userstory(link):
|
||||||
|
|
||||||
# Set custom field for platform link if enabled and configured
|
# Set custom field for platform link if enabled and configured
|
||||||
if bool(CONFIG["taiga"]["userstory_use_custom_field"]):
|
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()))
|
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"], us_attributes))[0]["id"]
|
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)
|
story.set_attribute(attribute_id, link)
|
||||||
|
|
||||||
# Find id for desired status of newly tasks
|
# 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_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"], task_statuses))[0]["id"]
|
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
|
tmpdir = tempfile.TemporaryDirectory() #workdir for downloads
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue