2026.11.1: offline flight logging fixed, inspections from logbook entries, life limits from installation, component inspections moved to inspection types

- Service worker keeps the Log Flight form when opened via Turbo, serves the offline page's script and icon, and treats 502/503/504 as offline; the offline page only links forms actually kept
- Serviced sub-components restart from the airframe time flown since the entry
- New logbook entries can complete inspections (recorded and linked to the entry)
- Components: replacement limit can count from installation (life limit)
- Component-level "Inspect every" / "Inspection critical" removed; a migration converts any unlinked settings into inspection types with a first record; component page lists its inspections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-12 07:30:59 -05:00
1 parent 7552e4a8a3
commit 352a38c7fb
28 files changed
+289 -69

No files matched your search

+4 -3
View File
@@ -145,10 +145,11 @@ module AircraftArchive
manufacturer: c.manufacturer, model: c.model, serial_number: c.serial_number, install_location: c.install_location,
expires_on: c.expires_on&.iso8601, notes: c.notes, status: c.status, date_in_service: c.date_in_service&.iso8601, hours_in_service: dec(c.hours_in_service),
hours_since_overhaul: dec(c.hours_since_overhaul), overhaul_date: c.overhaul_date&.iso8601, tbo_hours: c.tbo_hours,
tbo_days: c.tbo_days, inspection_hours: c.inspection_hours, inspection_days: c.inspection_days,
tbo_days: c.tbo_days,
replacement_hours: c.replacement_hours, replacement_days: c.replacement_days,
replacement_months: c.replacement_months, tbo_months: c.tbo_months, inspection_months: c.inspection_months, tbo_critical: c.tbo_critical,
on_condition: c.on_condition, inspection_critical: c.inspection_critical, replacement_critical: c.replacement_critical }
replacement_months: c.replacement_months, tbo_months: c.tbo_months, tbo_critical: c.tbo_critical,
on_condition: c.on_condition, replacement_critical: c.replacement_critical,
replacement_from_install: c.replacement_from_install }
end
def logbook_hash(e)
+3 -3
View File
@@ -215,9 +215,9 @@ module AircraftArchive
status: Component::STATUSES.key?(data["status"]) ? data["status"] : "SPARE",
date_in_service: date(data["date_in_service"]) || Date.new(1900, 1, 1), hours_in_service: num(data["hours_in_service"]) || 0,
hours_since_overhaul: num(data["hours_since_overhaul"]) || 0, overhaul_date: date(data["overhaul_date"]),
**data.slice(*%w[tbo_hours tbo_days inspection_hours inspection_days replacement_hours replacement_days
tbo_months inspection_months replacement_months]).symbolize_keys,
**data.slice(*%w[tbo_critical on_condition inspection_critical replacement_critical]).transform_values { _1 == true }.symbolize_keys
**data.slice(*%w[tbo_hours tbo_days replacement_hours replacement_days
tbo_months replacement_months]).symbolize_keys,
**data.slice(*%w[tbo_critical on_condition replacement_critical replacement_from_install]).transform_values { _1 == true }.symbolize_keys
)
c.save!(validate: false)
@map[:component][data["id"].to_s] = c.id
+6 -5
View File
@@ -146,19 +146,20 @@ class Airworthiness
desc = ""
if c.replacement_critical? && c.replacement_hours
if c.hours_since_overhaul >= c.replacement_hours
used = c.replacement_hours_used
if used >= c.replacement_hours
overdue = true
desc = "Replace every #{c.replacement_hours} hrs. Current: #{c.hours_since_overhaul} hrs."
elsif c.hours_since_overhaul + HOURS_WARNING >= c.replacement_hours
desc = "Replace every #{c.replacement_hours} hrs. Current: #{used} hrs#{' since installed' if c.replacement_from_install?}."
elsif used + HOURS_WARNING >= c.replacement_hours
approaching = true
desc = "Replace in #{c.replacement_hours - c.hours_since_overhaul} hrs."
desc = "Replace in #{c.replacement_hours - used} hrs."
end
end
if c.replacement_critical? && (due = c.next_replacement_date)
if @today >= due
overdue = true
desc = "Replace every #{c.replacement_interval_label}. Last serviced #{c.overhaul_date}."
desc = "Replace every #{c.replacement_interval_label}. #{c.replacement_from_install? ? 'Installed' : 'Last serviced'} #{c.replacement_counted_from}."
elsif @today + DAYS_WARNING >= due
approaching = true
desc = "Replace in #{(due - @today).to_i} days."
+2 -8
View File
@@ -57,23 +57,17 @@ class DueList
end
end
# A component's own "Inspect every" counts from its last service; when an
# inspection type covers the component, that inspection (tracked from its
# records, under inspections) governs instead.
def components
@aircraft.components.in_use.includes(:component_type, :inspection_types).flat_map do |c|
@aircraft.components.in_use.includes(:component_type).flat_map do |c|
label = "#{c} #{c.model}".strip
path = @urls.aircraft_component_path(@aircraft, c)
since_service = c.hours_since_overhaul.to_d
[
(item("replace-#{c.id}", "Replace #{label}", "component", path, date: c.next_replacement_date,
hours_left: c.replacement_hours && c.replacement_hours - since_service) if c.replacement_hours || c.replacement_calendar?),
hours_left: c.hours_to_replacement) if c.replacement_hours || c.replacement_calendar?),
(item("tbo-#{c.id}", "#{label} reaches TBO", "component", path,
date: c.tbo_after(c.overhaul_date),
hours_left: c.tbo_hours && c.tbo_hours - since_service) if (c.tbo_hours || c.tbo_calendar?) && !c.on_condition?),
(item("inspect-#{c.id}", "Inspect #{label}", "component", path,
date: c.inspection_after(c.overhaul_date),
hours_left: c.inspection_hours && c.inspection_hours - since_service) if (c.inspection_hours || c.inspection_calendar?) && c.inspection_types.empty?),
(item("expires-#{c.id}", "#{label} expires", "component", path, date: c.expires_on) if c.expires_on)
]
end