Class: Analytic::Period
- Inherits:
-
Object
- Object
- Analytic::Period
- Defined in:
- app/models/analytic/period.rb
Constant Summary collapse
- PAGES_LIMIT =
8
Instance Attribute Summary collapse
Instance Method Summary collapse
- #count ⇒ Integer
- #distinct_sessions_count ⇒ Integer
- #distinct_visitors_count ⇒ Integer
-
#initialize(range:) ⇒ Period
constructor
A new instance of Period.
- #pages ⇒ Array<Array(String, String, Integer)>
Constructor Details
#initialize(range:) ⇒ Period
Returns a new instance of Period.
11 12 13 |
# File 'app/models/analytic/period.rb', line 11 def initialize(range:) @range = range end |
Instance Attribute Details
#range ⇒ Range <Time>
8 9 10 |
# File 'app/models/analytic/period.rb', line 8 def range @range end |
Instance Method Details
#count ⇒ Integer
16 |
# File 'app/models/analytic/period.rb', line 16 delegate :count, to: :views |
#distinct_sessions_count ⇒ Integer
22 |
# File 'app/models/analytic/period.rb', line 22 delegate :distinct_sessions_count, to: :views |
#distinct_visitors_count ⇒ Integer
19 |
# File 'app/models/analytic/period.rb', line 19 delegate :distinct_visitors_count, to: :views |
#pages ⇒ Array<Array(String, String, Integer)>
25 26 27 28 29 30 31 32 |
# File 'app/models/analytic/period.rb', line 25 def pages views .group(:host) .group(:path) .order(count: :desc) .limit(PAGES_LIMIT) .pluck(:host, :path, Arel.sql('COUNT(*) AS count')) end |