mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Recordkeeping procedures, QC audits and user instructions (AC 120-78B)
- Admin → Recordkeeping Procedures: generated procedures document (2.2.11 / 3.2.8) from the system setup plus owner-entered details; adopted as numbered, immutable revisions; included in the records package - Admin → Records Audits: periodic QC checklist (3.2.8.5) combining app checks with a restore test, sampled entries vs. source documents and a user review; next due date on About and in admins' weekly reminder - User instructions at /help/records, linked from the logbook and signing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68a1719db2
commit
761f381679
27 files changed
+668
-10
No files matched your search
@@ -0,0 +1,21 @@
|
||||
class Admin::AuditsController < ApplicationController
|
||||
before_action :require_admin!
|
||||
|
||||
def index
|
||||
@audits = AuditRun.latest_first.includes(:performed_by)
|
||||
end
|
||||
|
||||
def new
|
||||
@audit = RecordsAudit.new
|
||||
end
|
||||
|
||||
def create
|
||||
answers = params.fetch(:answers, {}).permit(RecordsAudit::MANUAL.keys.index_with { %i[passed note] }).to_h
|
||||
run = RecordsAudit.new.record!(user: current_user, answers: answers, notes: params[:notes], sample_ids: Array(params[:sample_ids]).map(&:to_i))
|
||||
redirect_to admin_audit_path(run), notice: run.passed ? "Audit recorded: everything passed." : "Audit recorded, with items that didn't pass. Note what's being done about them."
|
||||
end
|
||||
|
||||
def show
|
||||
@audit = AuditRun.find(params[:id])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
# The electronic signature and recordkeeping procedures document
|
||||
# (AC 120-78B 2.2.11 / 3.2.8): the owner fills in what the app can't know,
|
||||
# reviews the generated draft, and adopts it as a numbered revision.
|
||||
class Admin::ProceduresController < ApplicationController
|
||||
before_action :require_admin!
|
||||
|
||||
def show
|
||||
@policy = RecordkeepingPolicy.current
|
||||
@revisions = ProceduresRevision.latest_first.includes(:adopted_by)
|
||||
end
|
||||
|
||||
def update
|
||||
@policy = RecordkeepingPolicy.current
|
||||
if @policy.update(params.require(:recordkeeping_policy).permit(:operator_name, :responsible_name, :responsible_title, :hosting_description,
|
||||
:offsite_backup_description, :audit_interval_months, :audit_sample_size,
|
||||
:additional_procedures))
|
||||
redirect_to admin_procedures_path, notice: "Saved. Review the draft and adopt it as a new revision when it's right."
|
||||
else
|
||||
@revisions = ProceduresRevision.latest_first
|
||||
render :show, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# The current draft, printable.
|
||||
def draft
|
||||
render html: draft_html.html_safe, layout: "report"
|
||||
end
|
||||
|
||||
def adopt
|
||||
policy = RecordkeepingPolicy.current
|
||||
return redirect_to(admin_procedures_path, alert: "Fill in the operator, responsible person, hosting and off-site backup first.") unless policy.complete?
|
||||
number = (ProceduresRevision.maximum(:number) || 0) + 1
|
||||
revision = ProceduresRevision.create!(number: number, adopted_by: current_user, adopted_at: Time.current,
|
||||
summary: params[:summary].to_s.strip.first(500).presence || "Revision #{number}",
|
||||
content: draft_html(number: number, summary: params[:summary].to_s.strip.first(500)))
|
||||
redirect_to admin_procedures_path, notice: "Revision #{revision.number} adopted. Print it or keep the PDF with your records."
|
||||
end
|
||||
|
||||
def revision
|
||||
@revision = ProceduresRevision.find(params[:id])
|
||||
render html: @revision.content.html_safe, layout: "report"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def draft_html(number: nil, summary: nil)
|
||||
render_to_string(partial: "admin/procedures/document",
|
||||
locals: { policy: RecordkeepingPolicy.current, number: number || "#{(ProceduresRevision.maximum(:number) || 0) + 1} (draft)",
|
||||
adopted_at: number ? Time.current : nil, adopted_by: number ? current_user : nil,
|
||||
revisions: ProceduresRevision.latest_first.to_a, summary: summary })
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user