From 7552e4a8a32babfe0f75634a50b74db4facc2207 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 11 Nov 2026 21:45:54 -0500 Subject: [PATCH] Status report readable in dark mode and Back no longer breaks the theme; drop the Overview's Coming due card The report layout now always loads as a full page (turbo-visit-control reload) and without Turbo (an inline Print handler), so the app's dark theme isn't carried onto the white report and the report's styles aren't left behind on Back. Coming due repeated the Airworthiness card, so it's gone. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- app/controllers/aircraft_controller.rb | 1 - app/services/due_list.rb | 11 ---------- app/views/aircraft/_coming_due.html.erb | 22 ------------------- app/views/aircraft/show.html.erb | 2 -- app/views/layouts/report.html.erb | 8 ++++++- docs/guide/aircraft.md | 1 - ...test.rb => overview_and_intervals_test.rb} | 20 +++++++++++------ 8 files changed, 21 insertions(+), 46 deletions(-) delete mode 100644 app/views/aircraft/_coming_due.html.erb rename test/integration/{overview_due_and_intervals_test.rb => overview_and_intervals_test.rb} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd97e07..c6062c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ The first numbered release. Highlights of what Simple Aircraft Manager does as o - Airworthiness status from ADs, inspections, squawks, components and documents, with Part 91 rules (annual as 100-hour, overruns, IFR and transponder limits). - ADs: FAA DRS import with an AD baseline per model, and a weekly search for newly published ADs covering the aircraft, engine, propeller and every installed component. - Logbook: templates, engine and propeller times, sub-components (a new entry can also record them serviced or replaced), printable entries for the paper logbook, and AI transcription of scanned pages. -- The Overview shows what's coming due in the next 30 days or 10 hours, and the last day's flying. +- The Overview shows the last day's flying: route, meters, fuel and oil left. - Intervals are entered as a number of days, months or years: no converting months to days. - Calendar feed of everything coming due, with dates projected from recent flying for hour-based items. - Weight and balance with a loading calculator (CG envelope in inches or lb-in/1000). diff --git a/app/controllers/aircraft_controller.rb b/app/controllers/aircraft_controller.rb index d79be44..52c5d57 100644 --- a/app/controllers/aircraft_controller.rb +++ b/app/controllers/aircraft_controller.rb @@ -14,7 +14,6 @@ class AircraftController < ApplicationController @notes = @aircraft.notes.recent_first.includes(:user).limit(5) @oil = ConsumptionStats.new(@aircraft, "oil") @fuel = ConsumptionStats.new(@aircraft, "fuel") - @coming_due = DueList.new(@aircraft).soon last = @aircraft.flight_logs.recent_first.first @last_day = last && @aircraft.flight_logs.where(date: last.date).order(:created_at).to_a end diff --git a/app/services/due_list.rb b/app/services/due_list.rb index 2a5cec4..6a3b8db 100644 --- a/app/services/due_list.rb +++ b/app/services/due_list.rb @@ -9,10 +9,6 @@ class DueList end # Hours flown per day over the past year (nil when it hasn't flown). - # What counts as coming up soon (Overview). - SOON_DAYS = 30 - SOON_HOURS = 10 - def self.daily_rate(aircraft, today: Date.current) hours = aircraft.flight_logs.where(date: (today - 365)..today).sum(:tach_time).to_f hours.positive? ? hours / 365.0 : nil @@ -30,13 +26,6 @@ class DueList (inspections + ads + components + documents).compact.sort_by { [ _1.date, _1.title ] } end - # Due in the next SOON_DAYS days or SOON_HOURS hours (or overdue). - def soon - horizon = @today + SOON_DAYS - hours_limit = @now_hours + SOON_HOURS - items.select { |i| i.date <= horizon || (i.due_hours && i.due_hours <= hours_limit) } - end - private # The date it's due: the calendar date, or when the hours run out at the diff --git a/app/views/aircraft/_coming_due.html.erb b/app/views/aircraft/_coming_due.html.erb deleted file mode 100644 index ee34192..0000000 --- a/app/views/aircraft/_coming_due.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%# What's due in the next few weeks or hours (Overview). %> -
-
-

Coming due

- next <%= DueList::SOON_DAYS %> days or <%= DueList::SOON_HOURS %> hrs -
- <% if due.any? %> -
    - <% due.each do |item| %> -
  • - <%= link_to item.title, item.path, class: [ "hover:underline", ("font-medium text-red-700" if item.overdue?) ] %> - - <% if item.overdue? %>overdue<% else %><%= "~" if item.projected %><%= fmt_date(item.date) %><% end %><%= " · at #{hours(item.due_hours)} hrs" if item.due_hours %> - -
  • - <% end %> -
- <% if due.any?(&:projected) %>

"~" dates are estimated from the last year's flying.

<% end %> - <% else %> - <%= empty_state "Nothing coming due soon." %> - <% end %> -
diff --git a/app/views/aircraft/show.html.erb b/app/views/aircraft/show.html.erb index c2a0fde..c94e68f 100644 --- a/app/views/aircraft/show.html.erb +++ b/app/views/aircraft/show.html.erb @@ -46,8 +46,6 @@ <% end %> - <%= render "aircraft/coming_due", aircraft: @aircraft, due: @coming_due %> -

Consumption

<%= link_to "Oil & fuel →", aircraft_consumable_records_path(@aircraft), class: "link text-sm" %>
diff --git a/app/views/layouts/report.html.erb b/app/views/layouts/report.html.erb index cb47d2b..cc4bb85 100644 --- a/app/views/layouts/report.html.erb +++ b/app/views/layouts/report.html.erb @@ -7,9 +7,15 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> + <%# Always a full page load: a Turbo visit would keep the app's dark theme + on this white page, and leave this page's styles behind on Back. %> + <% unless @standalone %><% end %> <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> + <%# No Turbo here (Back is then an ordinary page load); just the Print button. %> +