diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-08-26 13:48:52 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-08-26 13:58:20 +0300 |
commit | 331080bca683fdab73520f68c53f6a5367d17f22 (patch) | |
tree | 2aaf99f087b86c25fe7e0d25feb22f501437bdf9 /app/controllers/projects/cycle_analytics_controller.rb | |
parent | ce6bcdd0043caf267d5d4478d45741aa4ecf1ac9 (diff) |
Fetch cycle analytics data for a specific date range.
1. Supported date ranges are 30 / 90 days ago. The default is 90 days
ago.
2. All issues created before "x days ago" are filtered out, even if they
have other related data (test runs, merge requests) within the filter
range.
Diffstat (limited to 'app/controllers/projects/cycle_analytics_controller.rb')
-rw-r--r-- | app/controllers/projects/cycle_analytics_controller.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb index 85c81cba511..002a71b593d 100644 --- a/app/controllers/projects/cycle_analytics_controller.rb +++ b/app/controllers/projects/cycle_analytics_controller.rb @@ -1,5 +1,21 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController def show - @cycle_analytics = CycleAnalytics.new(@project) + @cycle_analytics = CycleAnalytics.new(@project, from: parse_start_date) + end + + private + + def parse_start_date + case cycle_analytics_params[:start_date] + when '30' then 30.days.ago + when '90' then 90.days.ago + else 90.days.ago + end + end + + def cycle_analytics_params + return {} unless params[:cycle_analytics].present? + + { start_date: params[:cycle_analytics][:start_date] } end end |