Add a Last 7 days option for Cycle Analytics view

This commit is contained in:
Mehdi Lahmam 2017-08-10 08:42:28 +02:00
parent 4e8a2feb71
commit 6e3ca79ded
4 changed files with 30 additions and 1 deletions

View file

@ -6,6 +6,13 @@ module CycleAnalyticsParams
end
def start_date(params)
params[:start_date] == '30' ? 30.days.ago : 90.days.ago
case params[:start_date]
when '7'
7.days.ago
when '30'
30.days.ago
else
90.days.ago
end
end
end

View file

@ -39,6 +39,9 @@
%span.dropdown-label {{ n__('Last %d day', 'Last %d days', 30) }}
%i.fa.fa-chevron-down
%ul.dropdown-menu.dropdown-menu-align-right
%li
%a{ "href" => "#", "data-value" => "7" }
{{ n__('Last %d day', 'Last %d days', 7) }}
%li
%a{ "href" => "#", "data-value" => "30" }
{{ n__('Last %d day', 'Last %d days', 30) }}

View file

@ -0,0 +1,5 @@
---
title: Add a `Last 7 days` option for Cycle Analytics view
merge_request: 13443
author: Mehdi Lahmam (@mehlah)
type: added

View file

@ -75,6 +75,20 @@ feature 'Cycle Analytics', js: true do
click_stage('Production')
expect_issue_to_be_present
end
context "when I change the time period observed" do
before do
_two_weeks_old_issue = create(:issue, project: project, created_at: 2.weeks.ago)
click_button('Last 30 days')
click_link('Last 7 days')
wait_for_requests
end
it 'shows only relevant data' do
expect(new_issues_counter).to have_content('1')
end
end
end
context "when my preferred language is Spanish" do