Class: Chartable::Queries::Quarterly

Inherits:
Object
  • Object
show all
Defined in:
lib/chartable/queries/quarterly.rb

Class Method Summary collapse

Class Method Details

.call(scope, on:) ⇒ Hash

It returns analytics data for the quarterly period. Example output: ‘2018” => 1, “Q2 2018” => 1`

Returns:

  • (Hash)


8
9
10
# File 'lib/chartable/queries/quarterly.rb', line 8

def self.call(scope, on:)
  scope.group("CONCAT('Q', QUARTER(#{on}), DATE_FORMAT(#{on},' %Y'))").size
end