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

cycle_analytics_params.rb « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c1ef848e1e7dd2b6e612545c0bfc26c5488dd4ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module CycleAnalyticsParams
  extend ActiveSupport::Concern

  def options(params)
    @options ||= { from: start_date(params), current_user: current_user }
  end

  def start_date(params)
    case params[:start_date]
    when '7'
      7.days.ago
    when '30'
      30.days.ago
    else
      90.days.ago
    end
  end
end