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:



7078
7079
7080
7081
# File 'lib/parse/query.rb', line 7078

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

#countGroupedResult

Count the number of items in each time period.

Returns:



7062
7063
7064
7065
# File 'lib/parse/query.rb', line 7062

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:



7096
7097
7098
7099
# File 'lib/parse/query.rb', line 7096

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:



7088
7089
7090
7091
# File 'lib/parse/query.rb', line 7088

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:



7070
7071
7072
7073
# File 'lib/parse/query.rb', line 7070

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