mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Avionics logbook type
Aircraft with a separate avionics logbook can file radio, transponder and autopilot work under it: AVIONICS joins Aircraft, Engine, Propeller and Other everywhere a logbook is chosen or filtered (entry form, logbook filter, squawk resolution, templates, imports). - Logbook transcription knows it (schema enum and prompt), so scanned avionics pages aren't filed as Aircraft. - The API's ?log= filter and drafts API accept it; docs updated. - No migration: log_type is a string column. Existing entries unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a5ca534fd1
commit
acb8b87ca3
9 files changed
+39
-8
No files matched your search
@@ -36,7 +36,7 @@ module Api
|
||||
render json: { data: Compliance.ad_rows(aircraft).map { ApiPresenter.ad(_1) } }
|
||||
end
|
||||
|
||||
# Logbook entries, oldest first (paged); ?log=AC|ENG|PROP|OTHER, ?signed=true|false.
|
||||
# Logbook entries, oldest first (paged); ?log=AC|ENG|PROP|AVIONICS|OTHER, ?signed=true|false.
|
||||
def logbook_entries
|
||||
aircraft = find_aircraft(params[:id])
|
||||
scope = aircraft.logbook_entries.includes(:signature)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class LogbookEntry < ApplicationRecord
|
||||
include Versioned
|
||||
LOG_TYPES = LabelSet.new("logbook_entry.log_types", %w[AC ENG PROP OTHER])
|
||||
LOG_TYPES = LabelSet.new("logbook_entry.log_types", %w[AC ENG PROP AVIONICS OTHER])
|
||||
ENTRY_TYPES = LabelSet.new("logbook_entry.entry_types", %w[MAINTENANCE INSPECTION FLIGHT HOURS_UPDATE OTHER])
|
||||
|
||||
# Kind of certificate of the person approving return to service (43.9(a)(4)).
|
||||
|
||||
@@ -23,7 +23,7 @@ Entry types:
|
||||
- OTHER: administrative entries, certifications
|
||||
|
||||
Fields:
|
||||
- log_type: AC (airframe), ENG (engine), PROP (propeller), or OTHER
|
||||
- log_type: AC (airframe), ENG (engine), PROP (propeller), AVIONICS (a separate avionics logbook: radios, transponder, autopilot, GPS…), or OTHER
|
||||
- text: the entry text verbatim, or a close paraphrase where wording is unclear; write [?] for illegible words
|
||||
- aircraft_hours: the tach/total time the entry records (a number), or null if none is written
|
||||
- signoff_person / signoff_location: a string, or null (the person's name only; certificate details go below)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"date": { "type": ["string", "null"], "description": "YYYY-MM-DD, or null if unreadable" },
|
||||
"log_type": { "type": "string", "enum": ["AC", "ENG", "PROP", "OTHER"] },
|
||||
"log_type": { "type": "string", "enum": ["AC", "ENG", "PROP", "AVIONICS", "OTHER"] },
|
||||
"entry_type": { "type": "string", "enum": ["MAINTENANCE", "INSPECTION", "FLIGHT", "HOURS_UPDATE", "OTHER"] },
|
||||
"text": { "type": "string" },
|
||||
"aircraft_hours": { "type": ["number", "null"] },
|
||||
|
||||
@@ -73,6 +73,7 @@ en:
|
||||
AC: Aircraft
|
||||
ENG: Engine
|
||||
PROP: Propeller
|
||||
AVIONICS: Avionics
|
||||
OTHER: Other
|
||||
entry_types:
|
||||
MAINTENANCE: Maintenance
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ Squawks have an `external_ref`: your own id for them, such as `redmine:issue:451
|
||||
| `GET /aircraft/:id/due` | Everything coming due, soonest first; items due by hours get a projected date |
|
||||
| `GET /aircraft/:id/inspections` | Each inspection's status and next due date and hours |
|
||||
| `GET /aircraft/:id/ads` | Each AD's status and next due date and hours |
|
||||
| `GET /aircraft/:id/logbook_entries` | Logbook entries, with their signatures (`?log=AC`, `ENG`, `PROP` or `OTHER`; `?signed=true` or `false`) |
|
||||
| `GET /aircraft/:id/logbook_entries` | Logbook entries, with their signatures (`?log=AC`, `ENG`, `PROP`, `AVIONICS` or `OTHER`; `?signed=true` or `false`) |
|
||||
| `GET /aircraft/:id/squawks` | Squawks (`?status=open`, the default, or `resolved` or `all`) |
|
||||
| `POST /aircraft/:id/squawks` | Report a squawk |
|
||||
| `GET /squawks?external_ref=…` | Find squawks by your id for them |
|
||||
@@ -120,7 +120,7 @@ POST /api/v1/aircraft/12/draft_batches
|
||||
} }
|
||||
```
|
||||
|
||||
- **One entry per logbook.** Items are grouped by `log` (`AC`, `ENG`, `PROP` or `OTHER`) into one unsigned entry each, their texts in order, so a visit that touched the engine and the airframe makes two entries, signed one after the other.
|
||||
- **One entry per logbook.** Items are grouped by `log` (`AC`, `ENG`, `PROP`, `AVIONICS` or `OTHER`) into one unsigned entry each, their texts in order, so a visit that touched the engine and the airframe makes two entries, signed one after the other.
|
||||
- **Inspections** (`completes_inspections`): each needs its `result`, `approved` (airworthy) or `discrepancies` (a list was given to the owner), and the draft needs `aircraft_hours`. The entry recording it is an inspection entry, in the logbook named by `log`, else the airframe log if an item is for it.
|
||||
- **Nothing is resolved until it's signed.** The squawks the items resolve and the inspections they complete are held until **every** entry of the draft is signed; then they're resolved and recorded, attributed to the person who signed last, and linked to the entry that described the work. A draft never clears a squawk on its own. The signer sees what signing will do before they sign.
|
||||
- **The signer.** Anyone with access to the aircraft and a certificate in their profile can sign, from each entry's `sign_url`. Give `signer.email` for someone else (a mechanic who isn't on the aircraft): each entry then gets an `invitation_url`, a link that lets that person sign that entry with their account for that address, for 14 days. When the integration acts for an Owner of the aircraft, the link also lets them create that account; otherwise they need one first. Pass the link on yourself (for example inside Redmine), or set `send_email: true` to have SAM email it.
|
||||
|
||||
@@ -7,7 +7,7 @@ The **Logbook** tab holds the maintenance record entries. Owners and Mechanics w
|
||||
**+ New Entry**:
|
||||
|
||||
1. Choose a **Template** to start the wording if one fits, and fill in its blanks (`__`). The built-in ones are for a pilot doing preventive maintenance on an aircraft they own or operate (14 CFR 43.3(g)); admins can add their own.
|
||||
2. Fill in the date, the **logbook** (aircraft, engine, propeller or other), the **entry type** (usually maintenance or inspection) and the **airframe total time**.
|
||||
2. Fill in the date, the **logbook** (aircraft, engine, propeller, avionics or other), the **entry type** (usually maintenance or inspection) and the **airframe total time**.
|
||||
3. For an engine or propeller entry, pick the component: its total time and time since overhaul at the entry fill in from the airframe time. Tick any **sub-components** included in the work (an oil filter on the engine) to record their times as well. On a new entry, set a sub-component to **Serviced** or **Replaced** to record that on the Components tab at the same time (an oil and filter change resets their time since service), dated to the entry.
|
||||
Its time since service then counts from the airframe time on the entry.
|
||||
Under **Inspections completed**, tick any inspection the work completes (an Oil Change): it's recorded as done on the Inspections tab at the entry's date and airframe time, linked to the entry.
|
||||
|
||||
@@ -4,7 +4,7 @@ These are the instructions for everyone who keeps or signs maintenance records h
|
||||
|
||||
## Writing an entry
|
||||
|
||||
On the aircraft's **Logbook** tab, choose **+ New Entry** (Owners and Mechanics: the **Write logbook entries** permission). Give the date, the logbook (aircraft, engine, propeller), the airframe total time and what was done. For an engine or propeller entry, pick the component (its times fill in) and tick any sub-components. A template can start the wording. An entry isn't a signed record until it's signed. See [The logbook](logbook.md).
|
||||
On the aircraft's **Logbook** tab, choose **+ New Entry** (Owners and Mechanics: the **Write logbook entries** permission). Give the date, the logbook (aircraft, engine, propeller, avionics or other), the airframe total time and what was done. For an engine or propeller entry, pick the component (its times fill in) and tick any sub-components. A template can start the wording. An entry isn't a signed record until it's signed. See [The logbook](logbook.md).
|
||||
|
||||
## Signing
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
require "test_helper"
|
||||
|
||||
# Aircraft with a separate avionics logbook file their radio, transponder
|
||||
# and autopilot work under it.
|
||||
class AvionicsLogbookTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@owner = create_user("owner@example.com")
|
||||
@a = create_aircraft(owner: @owner, tail_number: "N12345")
|
||||
sign_in @owner
|
||||
end
|
||||
|
||||
test "an entry can be written to the avionics logbook and the list filtered to it" do
|
||||
post aircraft_logbook_entries_path(@a), params: { logbook_entry: { date: "2026-10-01", log_type: "AVIONICS", entry_type: "MAINTENANCE",
|
||||
text: "Replaced Comm 2 radio; operational check normal." } }
|
||||
entry = @a.logbook_entries.sole
|
||||
assert_equal "AVIONICS", entry.log_type
|
||||
@a.logbook_entries.create!(date: Date.new(2026, 10, 2), log_type: "AC", entry_type: "MAINTENANCE", text: "Lubricated door hinges.")
|
||||
|
||||
get aircraft_logbook_entries_path(@a, log_type: "AVIONICS")
|
||||
assert_response :success
|
||||
assert_includes response.body, "Replaced Comm 2 radio"
|
||||
assert_not_includes response.body, "Lubricated door hinges"
|
||||
assert_includes response.body, ">Avionics<"
|
||||
end
|
||||
|
||||
test "logbook transcription and the drafts API know the avionics logbook" do
|
||||
assert LogbookEntry::LOG_TYPES.key?("AVIONICS")
|
||||
assert_includes JSON.parse(Rails.root.join("app/services/logbook_transcriber/schema.json").read).to_s, "AVIONICS"
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user