mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 22:26:22 +00:00
acumular visitas por país
This commit is contained in:
parent
cc839affb8
commit
9998f19087
1 changed files with 13 additions and 5 deletions
|
@ -58,12 +58,20 @@ class UriCollectionJob < PeriodicJob
|
||||||
# Acumular por mes y año
|
# Acumular por mes y año
|
||||||
reduce_rollup('host', beginning, **dimensions)
|
reduce_rollup('host', beginning, **dimensions)
|
||||||
|
|
||||||
|
columns = %i[http_referer geoip2_data_country_name]
|
||||||
|
columns.each do |column|
|
||||||
# Obtener orígenes de visitas por host
|
# Obtener orígenes de visitas por host
|
||||||
AccessLog.where(host: host).distinct(:http_referer).pluck(:http_referer).each do |http_referer|
|
AccessLog.where(host: host).distinct(column).pluck(column).each do |value|
|
||||||
dimensions[:http_referer] = http_referer
|
dimensions.delete_if do |k, _|
|
||||||
|
columns.include? k
|
||||||
|
end
|
||||||
|
|
||||||
rollup('host|referer', beginning, **dimensions)
|
name = "host|#{column}"
|
||||||
reduce_rollup('host|referer', beginning, **dimensions)
|
dimensions[column] = value
|
||||||
|
|
||||||
|
rollup(name, beginning, **dimensions)
|
||||||
|
reduce_rollup(name, beginning, **dimensions)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue