Class: AhoyCaptain::Stats::AverageViewsPerVisitQuery

Inherits:
BaseQuery show all
Defined in:
app/queries/ahoy_captain/stats/average_views_per_visit_query.rb

Overview

pls fix

Instance Attribute Summary

Attributes inherited from ApplicationQuery

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LazyComparableQuery

#with_lazy_comparison

Methods included from ComparableQuery

#with_comparison

Methods inherited from ApplicationQuery

call, inherited, #initialize, #inspect

Constructor Details

This class inherits a constructor from AhoyCaptain::ApplicationQuery

Class Method Details

.cast_type(_column) ⇒ Object



11
12
13
# File 'app/queries/ahoy_captain/stats/average_views_per_visit_query.rb', line 11

def self.cast_type(_column)
  nil
end

.cast_value(_, value) ⇒ Object



15
16
17
# File 'app/queries/ahoy_captain/stats/average_views_per_visit_query.rb', line 15

def self.cast_value(_, value)
  value.to_i
end

Instance Method Details

#buildObject



5
6
7
8
9
# File 'app/queries/ahoy_captain/stats/average_views_per_visit_query.rb', line 5

def build
  subquery = event_query.select("count(ahoy_events.visit_id) as count").where(name: "$view").group(:visit_id)

  AhoyCaptain.event.select("count").from("(#{subquery.to_sql}) as events")
end