mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-28 00:26:22 +00:00
Merge branch 'blazer' into panel.sutty.nl
This commit is contained in:
commit
3123552fea
2 changed files with 9 additions and 6 deletions
|
@ -30,14 +30,14 @@ module RecursiveRollup
|
||||||
#
|
#
|
||||||
# @param :name [String]
|
# @param :name [String]
|
||||||
# @param :new_name [String]
|
# @param :new_name [String]
|
||||||
# @param :interval_previous [String]
|
# @param :interval_previous [String, Symbol]
|
||||||
# @param :interval [String]
|
# @param :interval [String, Symbol]
|
||||||
# @param :operation [Symbol]
|
# @param :operation [Symbol]
|
||||||
# @param :dimensions [Hash]
|
# @param :dimensions [Hash]
|
||||||
# @param :beginning [Time]
|
# @param :beginning [Time]
|
||||||
# @return [Rollup]
|
# @return [Rollup]
|
||||||
def square_rollup(name:, new_name:, interval:, dimensions:, beginning:, operation: :sum)
|
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_dimensions(**dimensions)
|
||||||
.where('time >= ?', beginning.try(:"beginning_of_#{interval}"))
|
.where('time >= ?', beginning.try(:"beginning_of_#{interval}"))
|
||||||
.group(*dimensions_to_jsonb_query(dimensions))
|
.group(*dimensions_to_jsonb_query(dimensions))
|
||||||
|
|
|
@ -52,11 +52,11 @@ class UriCollectionJob < PeriodicJob
|
||||||
columns.each do |column|
|
columns.each do |column|
|
||||||
# Obtener orígenes de visitas por host
|
# Obtener orígenes de visitas por host
|
||||||
AccessLog.where(**host_dimensions).distinct(column).pluck(column).each do |value|
|
AccessLog.where(**host_dimensions).distinct(column).pluck(column).each do |value|
|
||||||
name = "#{name}|#{column}"
|
column_name = "host|#{column}"
|
||||||
dimensions[column] = value
|
dimensions[column] = value
|
||||||
|
|
||||||
rollup(name, beginning, **dimensions)
|
rollup(column_name, beginning, **dimensions)
|
||||||
reduce_rollup(name, beginning, **dimensions)
|
reduce_rollup(column_name, beginning, **dimensions)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -145,6 +145,9 @@ class UriCollectionJob < PeriodicJob
|
||||||
|
|
||||||
# Recolecta todas las URIs menos imágenes
|
# Recolecta todas las URIs menos imágenes
|
||||||
#
|
#
|
||||||
|
# TODO: Para los sitios con DeployLocalizedDomain estamos buscando
|
||||||
|
# URIs de más.
|
||||||
|
#
|
||||||
# @return [Array]
|
# @return [Array]
|
||||||
def uris
|
def uris
|
||||||
@uris ||=
|
@uris ||=
|
||||||
|
|
Loading…
Reference in a new issue