Class: Parse::SortableGroupByDate

Inherits:
GroupByDate show all
Defined in:
lib/parse/query.rb

Overview

Sortable version of GroupByDate that returns GroupedResult objects instead of plain hashes. Provides the same aggregation methods but with sorting capabilities.

Instance Method Summary collapse

Methods inherited from GroupByDate

#initialize, #order, #pipeline, #sort

Constructor Details

This class inherits a constructor from Parse::GroupByDate

Instance Method Details

#average(field) ⇒ GroupedResult Also known as: avg

Calculate average of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to average within each time period.

Returns:



7005
7006
7007
7008
# File 'lib/parse/query.rb', line 7005

def average(field)
  results = super
  GroupedResult.new(results)
end

#countGroupedResult

Count the number of items in each time period.

Returns:



6989
6990
6991
6992
# File 'lib/parse/query.rb', line 6989

def count
  results = super
  GroupedResult.new(results)
end

#max(field) ⇒ GroupedResult

Find maximum value of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to find maximum for within each time period.

Returns:



7023
7024
7025
7026
# File 'lib/parse/query.rb', line 7023

def max(field)
  results = super
  GroupedResult.new(results)
end

#min(field) ⇒ GroupedResult

Find minimum value of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to find minimum for within each time period.

Returns:



7015
7016
7017
7018
# File 'lib/parse/query.rb', line 7015

def min(field)
  results = super
  GroupedResult.new(results)
end

#sum(field) ⇒ GroupedResult

Sum a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to sum within each time period.

Returns:



6997
6998
6999
7000
# File 'lib/parse/query.rb', line 6997

def sum(field)
  results = super
  GroupedResult.new(results)
end