% content_for :title, "#{@aircraft.tail_number} Oil Analysis" %> <%= render "shared/aircraft_header", aircraft: @aircraft %> <% recent = @analyses.first(OilAnalysesController::COMPARE_SAMPLES) %>
AvLab PDF reports: each sample on the report (including previous ones) is added unless it's already here.
Lead is left out of the chart: it comes from 100LL fuel and reads in the thousands. Look for a steady trend rather than a single reading.
<% else %> <%= empty_state @analyses.any? ? "Add another sample to see trends." : "No oil analyses yet. Add one from your lab report." %> <% end %>| Element | <% recent.each do |a| %><%= link_to fmt_date(a.sample_date), aircraft_oil_analysis_path(@aircraft, a), class: "link" %> | <% end %>
|---|---|
| Engine / oil hrs | <% recent.each do |a| %><%= a.engine_hours ? hours(a.engine_hours) : "—" %> / <%= a.oil_hours ? hours(a.oil_hours) : "—" %> | <% end %>
| <%= label %> | <% recent.each do |a| %><%= ppm_cell(a, el) %> | <% end %>
| Sampled | Result | Engine | Engine hrs | Oil hrs | Lab | Report |
|---|---|---|---|---|---|---|
| <%= link_to fmt_date(a.sample_date), aircraft_oil_analysis_path(@aircraft, a), class: "link" %> | <%= oil_status_badge(a) %> <% if (flags = a.flagged_elements).any? %><%= flags.map { OilAnalysis.element_label(_1) }.to_sentence %> above average<% end %> | <%= a.component&.to_s || "—" %> | <%= a.engine_hours ? hours(a.engine_hours) : "—" %> | <%= a.oil_hours ? hours(a.oil_hours) : "—" %> | <%= [ a.lab, a.sample_number ].compact.join(" · ").presence || "—" %> | <%= a.report.attached? ? link_to("PDF", rails_blob_path(a.report, disposition: :inline), class: "link", target: "_blank", rel: "noopener") : "—" %> |