Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fa903956
Commit
fa903956
authored
Oct 13, 2016
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issues CSV avoids instantiating labels
parent
94e9d049
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
app/views/projects/issues/index.csv.ruby
app/views/projects/issues/index.csv.ruby
+9
-2
No files found.
app/views/projects/issues/index.csv.ruby
View file @
fa903956
labels
=
@issues
.
eager_load
(
:labels
).
pluck
(
:id
,
'labels.title'
).
inject
(
Hash
.
new
([]))
do
|
memo
,
(
issue_id
,
label
)
|
memo
[
issue_id
]
+=
[
label
]
memo
end
columns
=
{
columns
=
{
'Issue ID'
=>
'iid'
,
'Issue ID'
=>
'iid'
,
'Title'
=>
'title'
,
'Title'
=>
'title'
,
...
@@ -10,7 +17,7 @@ columns = {
...
@@ -10,7 +17,7 @@ columns = {
'Created At (UTC)'
=>
->
(
issue
)
{
issue
.
created_at
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
},
'Created At (UTC)'
=>
->
(
issue
)
{
issue
.
created_at
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
},
'Updated At (UTC)'
=>
->
(
issue
)
{
issue
.
updated_at
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
},
'Updated At (UTC)'
=>
->
(
issue
)
{
issue
.
updated_at
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
},
'Milestone'
=>
->
(
issue
)
{
issue
.
milestone
&
.
title
},
'Milestone'
=>
->
(
issue
)
{
issue
.
milestone
&
.
title
},
'Labels'
=>
->
(
issue
)
{
issue
.
labels_array
.
sort_by
(
&
:title
).
map
(
&
:title
).
join
(
','
).
presence
},
'Labels'
=>
->
(
issue
)
{
labels
[
issue
.
id
].
sort
.
join
(
','
).
presence
}
}
}
CsvBuilder
.
new
(
columns
).
render
(
@issues
.
includes
(
:author
,
:assignee
,
:labels
))
CsvBuilder
.
new
(
columns
).
render
(
@issues
.
includes
(
:author
,
:assignee
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment