no fallar si el intervalo está vacío
This commit is contained in:
parent
6c485e5e18
commit
7ab2ec5933
2 changed files with 2 additions and 2 deletions
|
@ -137,7 +137,7 @@ class StatsController < ApplicationController
|
||||||
# @return [Symbol]
|
# @return [Symbol]
|
||||||
def interval
|
def interval
|
||||||
@interval ||= begin
|
@interval ||= begin
|
||||||
i = params[:interval].to_sym
|
i = params[:interval]&.to_sym
|
||||||
Stat::INTERVALS.include?(i) ? i : :day
|
Stat::INTERVALS.include?(i) ? i : :day
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
.mb-3
|
.mb-3
|
||||||
- Stat::INTERVALS.each do |interval|
|
- Stat::INTERVALS.each do |interval|
|
||||||
= link_to t(".#{interval}"), site_stats_path(interval: interval, urls: params[:urls]), class: "btn #{'btn-primary active' if params[:interval].to_sym == interval}"
|
= link_to t(".#{interval}"), site_stats_path(interval: interval, urls: params[:urls]), class: "btn #{'btn-primary active' if @interval == interval}"
|
||||||
|
|
||||||
.mb-3
|
.mb-3
|
||||||
%h2= t('.host.title', count: @hostnames.size)
|
%h2= t('.host.title', count: @hostnames.size)
|
||||||
|
|
Loading…
Reference in a new issue