mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- 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>
22 lines
734 B
Ruby
22 lines
734 B
Ruby
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
|