diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-28 00:43:31 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-31 23:27:49 -0200 |
commit | bc7895fff80a038ff14e7319ef303e58474d161c (patch) | |
tree | dcfbddb6993b66b74f4f7fffc61f8b073f32aaa3 /app/models/label.rb | |
parent | 2525e55ec9bdd4b3a9e3284c71fde978cab6483a (diff) | |
download | gitlab-ce-bc7895fff80a038ff14e7319ef303e58474d161c.tar.gz |
Use label subject to calculate number of issues/mrs within the group
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 149fd98ecb3..d9287f2dc29 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -92,16 +92,23 @@ class Label < ActiveRecord::Base nil end - def open_issues_count(user = nil, project = nil) - issues_count(user, project_id: project.try(:id) || project_id, state: 'opened') + def open_issues_count(user = nil) + issues_count(user, state: 'opened') end - def closed_issues_count(user = nil, project = nil) - issues_count(user, project_id: project.try(:id) || project_id, state: 'closed') + def closed_issues_count(user = nil) + issues_count(user, state: 'closed') end - def open_merge_requests_count(user = nil, project = nil) - merge_requests_count(user, project_id: project.try(:id) || project_id, state: 'opened') + def open_merge_requests_count(user = nil) + params = { + subject_foreign_key => subject.id, + label_name: title, + scope: 'all', + state: 'opened' + } + + MergeRequestsFinder.new(user, params.with_indifferent_access).execute.count end def prioritize!(project, value) @@ -167,15 +174,8 @@ class Label < ActiveRecord::Base end def issues_count(user, params = {}) - IssuesFinder.new(user, params.reverse_merge(label_name: title, scope: 'all')) - .execute - .count - end - - def merge_requests_count(user, params = {}) - MergeRequestsFinder.new(user, params.reverse_merge(label_name: title, scope: 'all')) - .execute - .count + params.merge!(subject_foreign_key => subject.id, label_name: title, scope: 'all') + IssuesFinder.new(user, params.with_indifferent_access).execute.count end def label_format_reference(format = :id) |