Commit 29cabf06 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '34980-remove-obsolete-code' into 'master'

Remove obsolete code branch

Closes #34980

See merge request gitlab-org/gitlab!19612
parents f3087173 25818ef0
...@@ -37,26 +37,10 @@ class ProductivityAnalyticsFinder < MergeRequestsFinder ...@@ -37,26 +37,10 @@ class ProductivityAnalyticsFinder < MergeRequestsFinder
return items unless params[:merged_at_after] || params[:merged_at_before] return items unless params[:merged_at_after] || params[:merged_at_before]
items = items.joins(:metrics) 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].gteq(params[:merged_at_after])) if params[:merged_at_after]
items = items.where(metrics_table[:merged_at].lteq(merged_at_between[:to])) if merged_at_between[:to] items = items.where(metrics_table[:merged_at].lteq(params[:merged_at_before])) if params[:merged_at_before]
items items
end end
# rubocop: enable CodeReuse/ActiveRecord # 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 end
...@@ -62,20 +62,6 @@ describe ProductivityAnalyticsFinder do ...@@ -62,20 +62,6 @@ describe ProductivityAnalyticsFinder do
end end
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 context 'with merged_at_after and merged_at_before specified' do
let(:search_params) do let(:search_params) do
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment