From 6b191d2d91541df6ef40e36a354e3a3a071b3ef5 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 23 Apr 2022 19:37:08 -0300 Subject: [PATCH] =?UTF-8?q?usar=20la=20misma=20optimizaci=C3=B3n=20para=20?= =?UTF-8?q?stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/stat_collection_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/stat_collection_job.rb b/app/jobs/stat_collection_job.rb index e70544c3..3b68b61e 100644 --- a/app/jobs/stat_collection_job.rb +++ b/app/jobs/stat_collection_job.rb @@ -41,6 +41,7 @@ class StatCollectionJob < PeriodicJob # @return [NilClass] def rollup(name:, interval_previous:, interval:, operation: :sum) Rollup.where(name: name, interval: interval_previous) + .where('time >= ?', beginning_of_interval.try(:"beginning_of_#{interval}")) .where_dimensions(site_id: site.id) .group("dimensions->'site_id'") .rollup(name, interval: interval, update: true) do |rollup|