Module: Gitlab::Ci::Charts::MonthlyInterval

Included in:
YearChart
Defined in:
lib/gitlab/ci/charts.rb

Instance Method Summary collapse

Instance Method Details

#grouped_count(query) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


23
24
25
26
27
28
# File 'lib/gitlab/ci/charts.rb', line 23

def grouped_count(query)
  query
    .group("to_char(#{::Ci::Pipeline.table_name}.created_at, '01 Month YYYY')")
    .count(:created_at)
    .transform_keys(&:squish)
end

#interval_stepObject

rubocop: enable CodeReuse/ActiveRecord


31
32
33
# File 'lib/gitlab/ci/charts.rb', line 31

def interval_step
  @interval_step ||= 1.month
end