<%# Flying metrics. "Flight time" = Hobbs where recorded, else tach. %> <% periods = stats.periods %>
<% [ [ t(".past_30_days"), periods[0] ], [ t(".this_year"), periods[2] ], [ t(".past_12_months"), periods[1] ], [ t(".since", first_date: (fmt_date(stats.first_date))), periods[4] ] ].each do |title, p| %>
<%= title %>
<%= hours(p.flight) %> <%= t(".hrs") %>
<%= t(".tach_gal_html", count: p.flights, tach: (hours(p.tach)), fuel: (number_with_delimiter(p.fuel))) %>
<% end %>

<%= t(".flight_hours_by_month") %>

<%= t(".avg_hrs_month_over_the_html", monthly_average_past_year: (hours(stats.monthly_average_past_year))) %>
<%= column_chart stats.flight_hours_by_month, height: "220px", colors: [ "#0369a1" ], ytitle: "hrs", library: { plugins: { legend: { display: false } } } %>

<%= t(".totals") %>

<%= t(".flights_logged") %>
<%= number_with_delimiter(stats.count) %>
<%= t(".flight_time") %>
<%= t(".hrs_2_html", total_flight: (hours(stats.total_flight))) %>
<%= t(".tach_time") %>
<%= t(".hrs_3_html", total_tach: (hours(stats.total_tach))) %>
<%= t(".average_flight") %>
<%= t(".hrs_4_html", average_flight: (hours(stats.average_flight))) %>
<%= t(".longest_flight") %>
<%= t(".hrs_5_html", longest_flight: (hours(stats.longest_flight))) %>
<%= t(".fuel") %>
<%= t(".gal_html", total_fuel: (number_with_delimiter(stats.total_fuel))) %>
<%= t(".fuel_burn") %>
<%= t(".gal_hr_html", gph: (stats.gph || "—")) %>
<%= t(".airports_visited") %>
<%= stats.airports_visited %>
<% if stats.top_airports.any? %>
<%= t(".most_visited") %> <%= stats.top_airports.map { |code, n| "#{code} (#{n})" }.join(" · ") %>
<% end %>
<% if stats.by_year.size > 1 %>
<%= t(".by_year") %> <% stats.by_year.each do |y| %> <% end %>
<%= t(".year") %><%= t(".flights") %><%= t(".flight_hrs") %><%= t(".tach_hrs") %><%= t(".fuel_gal") %><%= t(".avg_flight") %>
<%= y.label %> <%= y.flights %> <%= hours(y.flight) %> <%= hours(y.tach) %> <%= number_with_delimiter(y.fuel) %> <%= y.flights.positive? ? hours(y.flight / y.flights) : "—" %>

<%= t(".flight_time_is_hobbs_time") %>

<% end %>