Commit a76951b1 authored by James Edwards-Jones's avatar James Edwards-Jones

Issue export CSV includes weight

parent 4182fe0b
......@@ -39,6 +39,8 @@ You will be asked to confirm the number of issues and email address for the expo
## Format
> **Time Estimate** and **Time Spent** columns were [introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2627) in GitLab Starter 10.0.
>
> The **Weight** column was [introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5300) in GitLab Starter 10.8.
Data will be encoded with a comma as the column delimiter, with `"` used to quote fields if needed, and newlines to separate rows. The first row will be the headers, which are listed in the following table along with a description of the values:
......@@ -59,6 +61,7 @@ Data will be encoded with a comma as the column delimiter, with `"` used to quot
| Created At (UTC) | Formated as `YYYY-MM-DD HH:MM:SS` |
| Updated At (UTC) | Formated as `YYYY-MM-DD HH:MM:SS` |
| Milestone | Title of the issue milestone |
| Weight | Issue weight |
| Labels | Title of any labels joined with a `,` |
| Time Estimate | [Time estimate](../../../workflow/time_tracking.md#estimates) in seconds |
| Time Spent | [Time spent](../../../workflow/time_tracking.md#time-spent) in seconds |
......
......@@ -43,6 +43,7 @@ module Issues
'Updated At (UTC)' => -> (issue) { issue.updated_at&.to_s(:csv) },
'Closed At (UTC)' => -> (issue) { issue.closed_at&.to_s(:csv) },
'Milestone' => -> (issue) { issue.milestone&.title },
'Weight' => -> (issue) { issue.weight },
'Labels' => -> (issue) { @labels[issue.id].sort.join(',').presence },
'Time Estimate' => ->(issue) { issue.time_estimate.to_s(:csv) },
'Time Spent' => -> (issue) { issue.timelogs.map(&:time_spent).inject(0, :+)}
......
---
title: Issues export CSV includes issue weight
merge_request: 5300
author:
type: changed
......@@ -41,6 +41,7 @@ describe Issues::ExportCsvService do
created_at: DateTime.new(2015, 4, 3, 2, 1, 0),
updated_at: DateTime.new(2016, 5, 4, 3, 2, 1),
closed_at: DateTime.new(2017, 6, 5, 4, 3, 2),
weight: 4,
labels: [feature_label, idea_label],
time_estimate: 72000)
issue.timelogs.create(time_spent: 360, user: user)
......@@ -118,6 +119,10 @@ describe Issues::ExportCsvService do
expect(csv[1]['Closed At (UTC)']).to eq nil
end
specify 'weight' do
expect(csv[0]['Weight']).to eq '4'
end
specify 'time estimate' do
expect(csv[0]['Time Estimate']).to eq '72000'
expect(csv[1]['Time Estimate']).to eq '0'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment