Module: Gitlab::Usage::TimeFrame

Constant Summary collapse

ALL_TIME_TIME_FRAME_NAME =
"all"
SEVEN_DAYS_TIME_FRAME_NAME =
"7d"
TWENTY_EIGHT_DAYS_TIME_FRAME_NAME =
"28d"

Instance Method Summary collapse

Instance Method Details

#monthly_time_rangeObject


14
15
16
# File 'lib/gitlab/usage/time_frame.rb', line 14

def monthly_time_range
  { start_date: 4.weeks.ago.to_date, end_date: Date.current }
end

#monthly_time_range_db_params(column: :created_at) ⇒ Object

This time range is skewed for batch counter performance. See gitlab.com/gitlab-org/gitlab/-/merge_requests/42972


20
21
22
# File 'lib/gitlab/usage/time_frame.rb', line 20

def monthly_time_range_db_params(column: :created_at)
  { column => 30.days.ago..2.days.ago }
end

#weekly_time_rangeObject


10
11
12
# File 'lib/gitlab/usage/time_frame.rb', line 10

def weekly_time_range
  { start_date: 7.days.ago.to_date, end_date: Date.current }
end