AD baseline: record DRS imports and the models they covered; weekly search starts from the last import; reminders and audit check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-11 20:56:20 -05:00
1 parent ba0455b149
commit 8bea2abf75
13 files changed
+169 -4

No files matched your search

@@ -51,6 +51,27 @@
<% end %>
</section>
<% last_drs = @aircraft.drs_imports.latest_first.first %>
<% missing = DrsImport.missing_models(@aircraft) %>
<section class="card mt-5" id="ad-baseline">
<div class="card-header">
<div>
<h2 class="card-title">AD baseline from FAA DRS</h2>
<p class="text-xs text-slate-500">The full list comes from DRS imports; the weekly search below adds what's published after.</p>
</div>
<% if owner? %><%= link_to "Import from FAA DRS", new_aircraft_ad_import_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
</div>
<div class="card-body space-y-2 text-sm">
<% if last_drs %>
<p>Last import <strong><%= last_drs.created_at.to_date %></strong> by <%= last_drs.user&.display_name || "—" %>: <%= last_drs.ad_count %> ADs<%= ", covering #{Array(last_drs.models_covered).to_sentence}" if Array(last_drs.models_covered).any? %>.</p>
<% if last_drs.created_at < DrsImport::RENEW_AFTER.ago %><p class="text-amber-800">Over a year old: import again to pick up revised ADs and anything the weekly search missed.</p><% end %>
<% else %>
<p class="text-amber-800">No DRS import yet. Export the ADs for each model from drs.faa.gov and import them here.</p>
<% end %>
<% if missing.any? %><p class="text-amber-800">Never imported for: <strong><%= missing.join(", ") %></strong>. Search DRS for each and import the file.</p><% end %>
</div>
</section>
<section class="card mt-5" id="new-ads">
<div class="card-header">
<div>
@@ -18,6 +18,8 @@
<% @certificates.each do |c| %><li><strong><%= c.expired? ? "Expired" : "Expires" %> <%= c.expires_on %>:</strong> <%= c.kind_label %> <%= c.number %></li><% end %>
</ul>
<% end %>
<% if @drs_due.any? %><p><strong>Refresh the AD list from FAA DRS</strong> (new ADs are found weekly, but revisions and anything missed come from a fresh import):</p>
<ul><% @drs_due.each do |a| %><li><%= link_to a.tail_number, aircraft_airworthiness_directives_url(a) %>: <%= (m = DrsImport.missing_models(a)).any? ? "never imported for #{m.to_sentence}" : "last import #{a.drs_imports.latest_first.first&.created_at&.to_date || 'never'}" %></li><% end %></ul><% end %>
<% if @audit_due %><p><strong>Records audit due <%= @audit_due %></strong> (AC 120-78B quality control): <%= link_to "start it", new_admin_audit_url %>.</p><% end %>
<p style="color: #64748b; font-size: 12px; margin-top: 20px;">
Based on the records in Simple Aircraft Manager. Turn these emails off on your <%= link_to "profile", edit_profile_url %>.
@@ -16,6 +16,13 @@ Your certificates:
- <%= c.expired? ? "Expired" : "Expires" %> <%= c.expires_on %>: <%= c.kind_label %> <%= c.number %>
<% end %>
<% end %>
<% if @drs_due.any? %>
AD list from FAA DRS needs a refresh:
<% @drs_due.each do |a| %>
- <%= a.tail_number %>: <%= (m = DrsImport.missing_models(a)).any? ? "never imported for #{m.to_sentence}" : "last import #{a.drs_imports.latest_first.first&.created_at&.to_date || 'never'}" %> (<%= aircraft_airworthiness_directives_url(a) %>)
<% end %>
<% end %>
<% if @audit_due %>
Records audit due <%= @audit_due %>: <%= new_admin_audit_url %>