<% content_for :title, 'Statistics' %>
<%= number_with_delimiter(current_user.total_distance) %> <%= DISTANCE_UNIT %>
Total distance
<%= number_with_delimiter @points_total %>
Geopoints tracked
<% if REVERSE_GEOCODING_ENABLED %> <%= render 'stats/reverse_geocoding_stats' %> <% end %>
<%= link_to 'Update stats', stats_path, data: { 'turbo-method' => :post }, class: 'btn btn-primary mt-5' %>
<% @stats.each do |year, stats| %>

<%= link_to year, "/stats/#{year}", class: 'underline hover:no-underline' %> <%= link_to '[Map]', map_url(year_timespan(year)), class: 'underline hover:no-underline' %>

<% cache [current_user, 'year_distance_stat', year], skip_digest: true do %> <%= number_with_delimiter year_distance_stat(year, current_user) %><%= DISTANCE_UNIT %> <% end %>

<% if REVERSE_GEOCODING_ENABLED %>
<%= countries_and_cities_stat_for_year(year, stats) %>
<% end %> <%= column_chart( Stat.year_distance(year, current_user), height: '200px', suffix: " #{DISTANCE_UNIT}", xtitle: 'Days', ytitle: 'Distance' ) %>
<% end %>