Class: AhoyCaptain::DeviceQuery

Inherits:
ApplicationQuery show all
Defined in:
app/queries/ahoy_captain/device_query.rb

Instance Attribute Summary

Attributes inherited from ApplicationQuery

#params

Instance Method Summary collapse

Methods inherited from ApplicationQuery

call, inherited, #initialize, #inspect

Constructor Details

This class inherits a constructor from AhoyCaptain::ApplicationQuery

Instance Method Details

#buildObject



3
4
5
6
7
8
# File 'app/queries/ahoy_captain/device_query.rb', line 3

def build
  visit_query
    .select("#{params[:devices_type]} as label", "count(#{params[:devices_type]}) as count", "sum(count(#{params[:devices_type]})) over() as total_count")
    .group(params[:devices_type])
    .order("count(#{params[:devices_type]}) desc")
end