From eec207cdacd0674dcbf96fa0984937c6cba4a117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Hermida?= Date: Tue, 11 Sep 2018 10:01:07 +0200 Subject: [PATCH] Add id's to reports. Fixes #1142 --- taiga/projects/epics/services.py | 10 ++++++---- taiga/projects/issues/services.py | 15 +++++++++------ taiga/projects/tasks/services.py | 17 ++++++++++++----- taiga/projects/userstories/services.py | 13 +++++++------ 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/taiga/projects/epics/services.py b/taiga/projects/epics/services.py index b43424cf..d1cfcb30 100644 --- a/taiga/projects/epics/services.py +++ b/taiga/projects/epics/services.py @@ -164,10 +164,11 @@ def update_epic_related_userstories_order_in_bulk(bulk_data: list, epic: object) def epics_to_csv(project, queryset): csv_data = io.StringIO() - fieldnames = ["ref", "subject", "description", "owner", "owner_full_name", "assigned_to", - "assigned_to_full_name", "status", "epics_order", "client_requirement", - "team_requirement", "attachments", "tags", "watchers", "voters", - "created_date", "modified_date", "related_user_stories"] + fieldnames = ["id", "ref", "subject", "description", "owner", "owner_full_name", + "assigned_to", "assigned_to_full_name", "status", "epics_order", + "client_requirement", "team_requirement", "attachments", "tags", + "watchers", "voters", "created_date", "modified_date", + "related_user_stories"] custom_attrs = project.epiccustomattributes.all() for custom_attr in custom_attrs: @@ -188,6 +189,7 @@ def epics_to_csv(project, queryset): writer.writeheader() for epic in queryset: epic_data = { + "id": epic.id, "ref": epic.ref, "subject": epic.subject, "description": epic.description, diff --git a/taiga/projects/issues/services.py b/taiga/projects/issues/services.py index 1a59bcb7..e0dacd9a 100644 --- a/taiga/projects/issues/services.py +++ b/taiga/projects/issues/services.py @@ -78,12 +78,13 @@ def create_issues_in_bulk(bulk_data, callback=None, precall=None, **additional_f def issues_to_csv(project, queryset): csv_data = io.StringIO() - fieldnames = ["ref", "subject", "description", "sprint", "sprint_estimated_start", - "sprint_estimated_finish", "owner", "owner_full_name", "assigned_to", - "assigned_to_full_name", "status", "severity", "priority", "type", - "is_closed", "attachments", "external_reference", "tags", "watchers", - "voters", "created_date", "modified_date", "finished_date", "due_date", - "due_date_reason"] + fieldnames = ["id", "ref", "subject", "description", "sprint_id", "sprint", + "sprint_estimated_start", "sprint_estimated_finish", "owner", + "owner_full_name", "assigned_to", "assigned_to_full_name", + "status", "severity", "priority", "type", "is_closed", + "attachments", "external_reference", "tags", "watchers", + "voters", "created_date", "modified_date", "finished_date", + "due_date", "due_date_reason"] custom_attrs = project.issuecustomattributes.all() for custom_attr in custom_attrs: @@ -103,9 +104,11 @@ def issues_to_csv(project, queryset): writer.writeheader() for issue in queryset: issue_data = { + "id": issue.id, "ref": issue.ref, "subject": issue.subject, "description": issue.description, + "sprint_id": issue.milestone.id if issue.milestone else None, "sprint": issue.milestone.name if issue.milestone else None, "sprint_estimated_start": issue.milestone.estimated_start if issue.milestone else None, "sprint_estimated_finish": issue.milestone.estimated_finish if issue.milestone else None, diff --git a/taiga/projects/tasks/services.py b/taiga/projects/tasks/services.py index a4ebb748..14fb7f8f 100644 --- a/taiga/projects/tasks/services.py +++ b/taiga/projects/tasks/services.py @@ -118,11 +118,16 @@ def snapshot_tasks_in_bulk(bulk_data, user): def tasks_to_csv(project, queryset): csv_data = io.StringIO() - fieldnames = ["ref", "subject", "description", "user_story", "sprint", "sprint_estimated_start", - "sprint_estimated_finish", "owner", "owner_full_name", "assigned_to", - "assigned_to_full_name", "status", "is_iocaine", "is_closed", "us_order", - "taskboard_order", "attachments", "external_reference", "tags", "watchers", - "voters", "created_date", "modified_date", "finished_date", "due_date", + fieldnames = ["id", "ref", "subject", "description", "user_story", "sprint_id", + "sprint", "sprint_estimated_start", "sprint_estimated_finish", + "owner", "owner_full_name", + "assigned_to", + "assigned_to_full_name", "status", "is_iocaine", "is_closed", + "us_order", + "taskboard_order", "attachments", "external_reference", + "tags", "watchers", + "voters", "created_date", "modified_date", "finished_date", + "due_date", "due_date_reason"] custom_attrs = project.taskcustomattributes.all() @@ -144,10 +149,12 @@ def tasks_to_csv(project, queryset): writer.writeheader() for task in queryset: task_data = { + "id": task.id, "ref": task.ref, "subject": task.subject, "description": task.description, "user_story": task.user_story.ref if task.user_story else None, + "sprint_id": task.milestone.id if task.milestone else None, "sprint": task.milestone.name if task.milestone else None, "sprint_estimated_start": task.milestone.estimated_start if task.milestone else None, "sprint_estimated_finish": task.milestone.estimated_finish if task.milestone else None, diff --git a/taiga/projects/userstories/services.py b/taiga/projects/userstories/services.py index aa333ee9..0574e509 100644 --- a/taiga/projects/userstories/services.py +++ b/taiga/projects/userstories/services.py @@ -194,12 +194,11 @@ def open_userstory(us): def userstories_to_csv(project, queryset): csv_data = io.StringIO() - fieldnames = ["ref", "subject", "description", "sprint", - "sprint_estimated_start", - "sprint_estimated_finish", "owner", "owner_full_name", - "assigned_to", - "assigned_to_full_name", "assigned_users", - "assigned_users_full_name", "status", "is_closed"] + fieldnames = ["id", "ref", "subject", "description", "sprint_id", "sprint", + "sprint_estimated_start", "sprint_estimated_finish", "owner", + "owner_full_name", "assigned_to", "assigned_to_full_name", + "assigned_users", "assigned_users_full_name", "status", + "is_closed"] roles = project.roles.filter(computable=True).order_by('slug') for role in roles: @@ -237,9 +236,11 @@ def userstories_to_csv(project, queryset): writer.writeheader() for us in queryset: row = { + "id": us.id, "ref": us.ref, "subject": us.subject, "description": us.description, + "sprint_id": us.milestone.id if us.milestone else None, "sprint": us.milestone.name if us.milestone else None, "sprint_estimated_start": us.milestone.estimated_start if us.milestone else None,