Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-07 12:08:18 +0300
committerJames Lopez <james@jameslopez.es>2016-11-17 10:22:57 +0300
commit192918cde949c8399d7d526a638f6e09f9fb7a5a (patch)
tree678d29be77beb72e782e713b8dcfddf9c93023d1 /app/controllers/projects/cycle_analytics_controller.rb
parentb4bb33c5b7f30dedbb56f4b9f7dbc9fd58d4bdb9 (diff)
refactored duplicated code in controller, updated JSON array naming and fixed specs
Diffstat (limited to 'app/controllers/projects/cycle_analytics_controller.rb')
-rw-r--r--app/controllers/projects/cycle_analytics_controller.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb
index 04f4cc7000e..96eb75a0547 100644
--- a/app/controllers/projects/cycle_analytics_controller.rb
+++ b/app/controllers/projects/cycle_analytics_controller.rb
@@ -1,11 +1,12 @@
class Projects::CycleAnalyticsController < Projects::ApplicationController
include ActionView::Helpers::DateHelper
include ActionView::Helpers::TextHelper
+ include CycleAnalyticsParams
before_action :authorize_read_cycle_analytics!
def show
- @cycle_analytics = ::CycleAnalytics.new(@project, from: parse_start_date)
+ @cycle_analytics = ::CycleAnalytics.new(@project, from: start_date(cycle_analytics_params))
respond_to do |format|
format.html
@@ -15,14 +16,6 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
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?