mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-22 14:21:49 +00:00
usar la misma optimización para stats
This commit is contained in:
parent
d8060728be
commit
6b191d2d91
1 changed files with 1 additions and 0 deletions
|
@ -41,6 +41,7 @@ class StatCollectionJob < PeriodicJob
|
||||||
# @return [NilClass]
|
# @return [NilClass]
|
||||||
def rollup(name:, interval_previous:, interval:, operation: :sum)
|
def rollup(name:, interval_previous:, interval:, operation: :sum)
|
||||||
Rollup.where(name: name, interval: interval_previous)
|
Rollup.where(name: name, interval: interval_previous)
|
||||||
|
.where('time >= ?', beginning_of_interval.try(:"beginning_of_#{interval}"))
|
||||||
.where_dimensions(site_id: site.id)
|
.where_dimensions(site_id: site.id)
|
||||||
.group("dimensions->'site_id'")
|
.group("dimensions->'site_id'")
|
||||||
.rollup(name, interval: interval, update: true) do |rollup|
|
.rollup(name, interval: interval, update: true) do |rollup|
|
||||||
|
|
Loading…
Reference in a new issue