Commit eb715e66 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'jprovazn-csv' into 'master'

Use 'preload' in export to CSV

Closes #4376

See merge request gitlab-org/gitlab-ee!3841
parents 8a0238ce 020701fa
---
title: Fix export to CSV if a filter with multiple labels is used
merge_request:
author:
type: fixed
...@@ -21,7 +21,7 @@ module Issues ...@@ -21,7 +21,7 @@ module Issues
def csv_builder def csv_builder
@csv_builder ||= @csv_builder ||=
CsvBuilder.new(@issues.includes(:author, :assignees, :timelogs), header_to_value_hash) CsvBuilder.new(@issues.preload(:author, :assignees, :timelogs), header_to_value_hash)
end end
private private
......
...@@ -127,6 +127,20 @@ describe Issues::ExportCsvService do ...@@ -127,6 +127,20 @@ describe Issues::ExportCsvService do
expect(csv[0]['Time Spent']).to eq '560' expect(csv[0]['Time Spent']).to eq '560'
expect(csv[1]['Time Spent']).to eq '0' expect(csv[1]['Time Spent']).to eq '0'
end end
context 'with issues filtered by labels and project' do
let(:subject) do
described_class.new(
IssuesFinder.new(user,
project_id: project.id,
label_name: %w(Idea Feature)).execute)
end
it 'returns only filtered objects' do
expect(csv.count).to eq(1)
expect(csv[0]['Issue ID']).to eq issue.iid.to_s
end
end
end end
context 'with minimal details' do context 'with minimal details' do
......
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