From 3f29d87acdb91d59f79fd38f105ea038c1909a94 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 20:41:38 -0300 Subject: [PATCH] =?UTF-8?q?las=20tablas=20tambi=C3=A9n=20est=C3=A1n=20filt?= =?UTF-8?q?radas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stats_controller.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 36b72721..c2eb0425 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -46,17 +46,17 @@ class StatsController < ApplicationController Stat::COLUMNS.each do |column| @columns[column] = Rails.cache.fetch("stats/#{column}/#{site.id}", expires_in: expires_in) do - Rollup.where(interval: interval, name: "host|#{column}") - .where_dimensions(host: hostnames) - .group("dimensions->>'#{column}'") - .sum(:value) - .transform_values(&:to_i) - .transform_values do |v| - v * nodes - end - .sort_by do |_, v| - v - end.reverse.to_h + rollup_scope.where(interval: interval, name: "host|#{column}") + .where_dimensions(host: hostnames) + .group("dimensions->>'#{column}'") + .sum(:value) + .transform_values(&:to_i) + .transform_values do |v| + v * nodes + end + .sort_by do |_, v| + v + end.reverse.to_h end end end