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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
1eb72a71
Commit
1eb72a71
authored
Feb 21, 2017
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored count_for_collection() for using pluck instead of select
parent
9a9a368f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+2
-2
app/models/merge_requests_closing_issues.rb
app/models/merge_requests_closing_issues.rb
+3
-3
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
1eb72a71
...
...
@@ -28,13 +28,13 @@ module IssuableCollections
downvotes
=
issuable_votes_count
.
find
{
|
votes
|
votes
.
awardable_id
==
id
&&
votes
.
downvote?
}
upvotes
=
issuable_votes_count
.
find
{
|
votes
|
votes
.
awardable_id
==
id
&&
votes
.
upvote?
}
notes
=
issuable_note_count
.
find
{
|
notes
|
notes
.
noteable_id
==
id
}
merge_requests
=
issuable_merge_requests_count
.
find
{
|
mr
|
mr
.
issue_id
==
id
}
merge_requests
=
issuable_merge_requests_count
.
find
{
|
mr
|
mr
.
first
==
id
}
issuable_meta
[
id
]
=
Issuable
::
IssuableMeta
.
new
(
upvotes
.
try
(
:count
).
to_i
,
downvotes
.
try
(
:count
).
to_i
,
notes
.
try
(
:count
).
to_i
,
merge_requests
.
try
(
:
coun
t
).
to_i
merge_requests
.
try
(
:
las
t
).
to_i
)
end
end
...
...
app/models/merge_requests_closing_issues.rb
View file @
1eb72a71
...
...
@@ -7,9 +7,9 @@ class MergeRequestsClosingIssues < ActiveRecord::Base
class
<<
self
def
count_for_collection
(
ids
)
select
(
'issue_id'
,
'COUNT(*) as count'
).
group
(
:issue_id
).
where
(
issue_id:
ids
)
where
(
issue_id:
ids
).
pluck
(
'issue_id'
,
'COUNT(*) as count'
)
end
end
end
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