From bd0f5bb62488b67910ddae1d99153eb515237220 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sun, 24 Mar 2024 19:48:07 +0100 Subject: [PATCH] Don't show chart if no data is available for monthly stats --- app/views/stats/_stat.html.erb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/stats/_stat.html.erb b/app/views/stats/_stat.html.erb index 7ea5ab99..843d9c2d 100644 --- a/app/views/stats/_stat.html.erb +++ b/app/views/stats/_stat.html.erb @@ -11,12 +11,14 @@ <%= stat.toponyms.count %> countries, <%= stat.toponyms.sum { _1['cities'].count } %> cities <% end %> - <%= column_chart( - stat.daily_distance, - height: '100px', - suffix: ' km', - xtitle: 'Days', - ytitle: 'Distance' - ) %> + <% if stat.daily_distance %> + <%= column_chart( + stat.daily_distance, + height: '100px', + suffix: ' km', + xtitle: 'Days', + ytitle: 'Distance' + ) %> + <% end %>