5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:31:43 +00:00

fixup! no se puede renombrar un rollup usando dimensiones exactas

This commit is contained in:
f 2022-04-30 10:03:14 -03:00
parent 121d4f49e2
commit b36bdc9763
2 changed files with 9 additions and 6 deletions

View file

@ -30,14 +30,14 @@ module RecursiveRollup
#
# @param :name [String]
# @param :new_name [String]
# @param :interval_previous [String]
# @param :interval [String]
# @param :interval_previous [String, Symbol]
# @param :interval [String, Symbol]
# @param :operation [Symbol]
# @param :dimensions [Hash]
# @param :beginning [Time]
# @return [Rollup]
def square_rollup(name:, new_name:, interval:, dimensions:, beginning:, operation: :sum)
Rollup.where(name: name, interval: interval_previous)
Rollup.where(name: name, interval: interval)
.where_dimensions(**dimensions)
.where('time >= ?', beginning.try(:"beginning_of_#{interval}"))
.group(*dimensions_to_jsonb_query(dimensions))

View file

@ -52,11 +52,11 @@ class UriCollectionJob < PeriodicJob
columns.each do |column|
# Obtener orígenes de visitas por host
AccessLog.where(**host_dimensions).distinct(column).pluck(column).each do |value|
name = "#{name}|#{column}"
column_name = "host|#{column}"
dimensions[column] = value
rollup(name, beginning, **dimensions)
reduce_rollup(name, beginning, **dimensions)
rollup(column_name, beginning, **dimensions)
reduce_rollup(column_name, beginning, **dimensions)
end
end
end
@ -145,6 +145,9 @@ class UriCollectionJob < PeriodicJob
# Recolecta todas las URIs menos imágenes
#
# TODO: Para los sitios con DeployLocalizedDomain estamos buscando
# URIs de más.
#
# @return [Array]
def uris
@uris ||=