no fallar si el intervalo está vacío

This commit is contained in:
f 2021-10-09 17:28:26 -03:00
parent 6c485e5e18
commit 7ab2ec5933
2 changed files with 2 additions and 2 deletions

View file

@ -137,7 +137,7 @@ class StatsController < ApplicationController
# @return [Symbol]
def interval
@interval ||= begin
i = params[:interval].to_sym
i = params[:interval]&.to_sym
Stat::INTERVALS.include?(i) ? i : :day
end
end

View file

@ -10,7 +10,7 @@
.mb-3
- 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
%h2= t('.host.title', count: @hostnames.size)