no fallar si no hay stat

closes #3228
This commit is contained in:
f 2021-10-20 17:36:30 -03:00
parent 07e5baa378
commit 7e16962041

View file

@ -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 ||= {