diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-02-21 12:45:08 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-02-21 12:45:08 +1100 |
commit | 1eb72a71f54da310b2277e5890dce27c15e11036 (patch) | |
tree | c8a2df777744ce615c22546227636bebc3b0d6e2 /app/controllers/concerns | |
parent | 9a9a368fe0bb0a5983794ab272c2a12259d77939 (diff) | |
download | gitlab-ce-1eb72a71f54da310b2277e5890dce27c15e11036.tar.gz |
Refactored count_for_collection() for using pluck instead of select
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/issuable_collections.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index d7d781cbe72..85ae4985e58 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -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(:count).to_i + merge_requests.try(:last).to_i ) end end |