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
Léo-Paul Géneau
gitlab-ce
Commits
76a1a7a2
Commit
76a1a7a2
authored
Oct 01, 2018
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract status count key to a method
parent
97e2de1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+5
-1
No files found.
app/finders/issuable_finder.rb
View file @
76a1a7a2
...
@@ -128,7 +128,7 @@ class IssuableFinder
...
@@ -128,7 +128,7 @@ class IssuableFinder
labels_count
=
1
if
use_cte_for_search?
labels_count
=
1
if
use_cte_for_search?
finder
.
execute
.
reorder
(
nil
).
group
(
:state
).
count
.
each
do
|
key
,
value
|
finder
.
execute
.
reorder
(
nil
).
group
(
:state
).
count
.
each
do
|
key
,
value
|
counts
[
Array
(
key
).
last
.
to_sym
]
+=
value
/
labels_count
counts
[
count_key
(
key
)
]
+=
value
/
labels_count
end
end
counts
[
:all
]
=
counts
.
values
.
sum
counts
[
:all
]
=
counts
.
values
.
sum
...
@@ -297,6 +297,10 @@ class IssuableFinder
...
@@ -297,6 +297,10 @@ class IssuableFinder
klass
.
all
klass
.
all
end
end
def
count_key
(
value
)
Array
(
value
).
last
.
to_sym
end
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
by_scope
(
items
)
def
by_scope
(
items
)
return
items
.
none
if
current_user_related?
&&
!
current_user
return
items
.
none
if
current_user_related?
&&
!
current_user
...
...
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