mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 18:26:21 +00:00
todas las peticiones necesitan une usuarie
This commit is contained in:
parent
a2e4e0ab89
commit
cfb2d7a61d
1 changed files with 6 additions and 5 deletions
|
@ -4,6 +4,7 @@
|
|||
class StatsController < ApplicationController
|
||||
include Pundit
|
||||
before_action :authenticate_usuarie!
|
||||
before_action :authorize_stats
|
||||
|
||||
INTERVALS = %i[hour day week month].freeze
|
||||
|
||||
|
@ -14,9 +15,6 @@ class StatsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@site = find_site
|
||||
authorize SiteStat.new(@site)
|
||||
|
||||
@chart_params = { interval: interval }
|
||||
hostnames
|
||||
last_stat
|
||||
|
@ -24,8 +22,6 @@ class StatsController < ApplicationController
|
|||
|
||||
# Genera un gráfico de visitas por dominio asociado a este sitio
|
||||
def host
|
||||
@site = find_site
|
||||
authorize SiteStat.new(@site)
|
||||
|
||||
@stats = Rollup.where_dimensions(host: hostnames).multi_series('host', interval: interval).tap do |series|
|
||||
series.each do |serie|
|
||||
|
@ -45,6 +41,11 @@ class StatsController < ApplicationController
|
|||
@last_stat ||= Stat.last
|
||||
end
|
||||
|
||||
def authorize_stats
|
||||
@site = find_site
|
||||
authorize SiteStat.new(@site)
|
||||
end
|
||||
|
||||
# TODO: Eliminar cuando mergeemos referer-origin
|
||||
def hostnames
|
||||
@hostnames ||= [@site.hostname, @site.alternative_hostnames].flatten
|
||||
|
|
Loading…
Reference in a new issue