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
25818ef0
Commit
25818ef0
authored
Nov 01, 2019
by
Pavel Shutsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete code branch
parent
f2876fb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
32 deletions
+2
-32
ee/app/finders/productivity_analytics_finder.rb
ee/app/finders/productivity_analytics_finder.rb
+2
-18
ee/spec/finders/productivity_analytics_finder_spec.rb
ee/spec/finders/productivity_analytics_finder_spec.rb
+0
-14
No files found.
ee/app/finders/productivity_analytics_finder.rb
View file @
25818ef0
...
...
@@ -37,26 +37,10 @@ class ProductivityAnalyticsFinder < MergeRequestsFinder
return
items
unless
params
[
:merged_at_after
]
||
params
[
:merged_at_before
]
items
=
items
.
joins
(
:metrics
)
items
=
items
.
where
(
metrics_table
[
:merged_at
].
gteq
(
merged_at_between
[
:from
]))
if
merged_at_between
[
:from
]
items
=
items
.
where
(
metrics_table
[
:merged_at
].
lteq
(
merged_at_between
[
:to
]))
if
merged_at_between
[
:to
]
items
=
items
.
where
(
metrics_table
[
:merged_at
].
gteq
(
params
[
:merged_at_after
]))
if
params
[
:merged_at_after
]
items
=
items
.
where
(
metrics_table
[
:merged_at
].
lteq
(
params
[
:merged_at_before
]))
if
params
[
:merged_at_before
]
items
end
# rubocop: enable CodeReuse/ActiveRecord
def
merged_at_between
@merged_at_between
||=
begin
if
merged_at_period
{
from:
Time
.
zone
.
now
.
ago
(
merged_at_period
.
days
)
}
else
{
from:
params
[
:merged_at_after
],
to:
params
[
:merged_at_before
]
}
end
end
end
def
merged_at_period
matches
=
params
[
:merged_at_after
]
&
.
match
(
/^(?<days>\d+)days?$/
)
matches
&&
matches
[
:days
].
to_i
end
end
ee/spec/finders/productivity_analytics_finder_spec.rb
View file @
25818ef0
...
...
@@ -62,20 +62,6 @@ describe ProductivityAnalyticsFinder do
end
end
context
'with merged_at_after specified as days-range'
do
let
(
:search_params
)
do
{
merged_at_after:
'11days'
}
end
it
'returns all MRs with merged date later than Xdays ago'
do
long_mr
short_mr
expect
(
subject
.
execute
).
to
match_array
([
long_mr
])
end
end
context
'with merged_at_after and merged_at_before specified'
do
let
(
:search_params
)
do
{
...
...
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