From 7e1696204183e73afa307e27d77ecbfd87f7c5b8 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Oct 2021 17:36:30 -0300 Subject: [PATCH] no fallar si no hay stat closes #3228 --- app/controllers/stats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 3fe821ac..b9b93e9f 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -121,7 +121,7 @@ class StatsController < ApplicationController # toma de estadísticas y restando el tiempo que pasó desde ese # momento. def chart_options - time = last_stat.created_at + 1.try(interval) + time = (last_stat&.created_at || Time.now) + 1.try(interval) please_return_at = { please_return_at: distance_of_time_in_words(Time.now, time) } @chart_options ||= {