Module: Gitlab::Ci::Charts::DailyInterval

Included in:
MonthChart, WeekChart
Defined in:
lib/gitlab/ci/charts.rb

Instance Method Summary collapse

Instance Method Details

#grouped_count(query) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


8
9
10
11
12
13
# File 'lib/gitlab/ci/charts.rb', line 8

def grouped_count(query)
  query
    .group("DATE(#{::Ci::Pipeline.table_name}.created_at)")
    .count(:created_at)
    .transform_keys { |date| date.strftime(@format) } # rubocop:disable Gitlab/ModuleWithInstanceVariables
end

#interval_stepObject

rubocop: enable CodeReuse/ActiveRecord


16
17
18
# File 'lib/gitlab/ci/charts.rb', line 16

def interval_step
  @interval_step ||= 1.day
end