Remove orphaned code and unused Solid Cable; simplify compliance status

- Delete methods nothing calls: BackupRun.last_good, EntrySignature#short_id,
  Sso#issuer_origin, InspectionType#effect_label and #latest_record_for,
  ApplicationHelper#airworthiness_dot, Airworthiness::Status#can_fly? and
  FlightStats#shortest_flight (tests now check red? / longest_flight)
- Routes: sessions and passwords limited to the actions that exist
- Theme toggle: drop the unused button target
- Action Cable was never used (no broadcasts or streams): async adapter in
  production, solid_cable gem, cable database and app/channels removed
- Empty system test setup removed with capybara and selenium-webdriver
- Compliance: one due_result helper for overdue / due soon; inspections use
  next_due for the date, as ADs do
- applicable_to moved into SharedRecordHistory (was identical in ADs and
  inspection types)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-13 21:04:41 -05:00
1 parent e939d29deb
commit bff6a05173
25 files changed
+33 -177

No files matched your search

+1 -8
View File
@@ -23,10 +23,9 @@ gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ] gem "tzinfo-data", platforms: %i[ windows jruby ]
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable # Use the database-backed adapters for Rails.cache and Active Job
gem "solid_cache" gem "solid_cache"
gem "solid_queue" gem "solid_queue"
gem "solid_cable"
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false gem "bootsnap", require: false
@@ -56,12 +55,6 @@ group :development do
gem "web-console" gem "web-console"
end end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
end
gem "chartkick", "~> 5.2" gem "chartkick", "~> 5.2"
gem "json", "~> 3.1" gem "json", "~> 3.1"
-30
View File
@@ -100,15 +100,6 @@ GEM
brakeman (8.1.0) brakeman (8.1.0)
racc racc
builder (3.3.0) builder (3.3.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
caxlsx (4.5.0) caxlsx (4.5.0)
htmlentities (~> 4.3, >= 4.3.4) htmlentities (~> 4.3, >= 4.3.4)
marcel (~> 1.0) marcel (~> 1.0)
@@ -404,16 +395,6 @@ GEM
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
rubyzip (3.7.0) rubyzip (3.7.0)
securerandom (0.4.1) securerandom (0.4.1)
selenium-webdriver (4.52.0)
base64 (~> 0.2)
logger (~> 1.4)
rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
solid_cable (4.1.0)
actioncable (>= 7.2)
activejob (>= 7.2)
activerecord (>= 7.2)
railties (>= 7.2)
solid_cache (1.0.10) solid_cache (1.0.10)
activejob (>= 7.2) activejob (>= 7.2)
activerecord (>= 7.2) activerecord (>= 7.2)
@@ -493,13 +474,10 @@ GEM
addressable (>= 2.8.0) addressable (>= 2.8.0)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
websocket (1.2.11)
websocket-driver (0.8.2) websocket-driver (0.8.2)
base64 base64
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.8.3) zeitwerk (2.8.3)
PLATFORMS PLATFORMS
@@ -518,7 +496,6 @@ DEPENDENCIES
bcrypt (~> 3.1.7) bcrypt (~> 3.1.7)
bootsnap bootsnap
brakeman brakeman
capybara
caxlsx (~> 4.5) caxlsx (~> 4.5)
chartkick (~> 5.2) chartkick (~> 5.2)
commonmarker (~> 2.10) commonmarker (~> 2.10)
@@ -540,8 +517,6 @@ DEPENDENCIES
rqrcode (~> 3.1) rqrcode (~> 3.1)
rubocop-rails-omakase rubocop-rails-omakase
rubyzip (~> 3.7) rubyzip (~> 3.7)
selenium-webdriver
solid_cable
solid_cache solid_cache
solid_queue solid_queue
sqlite3 (>= 2.1) sqlite3 (>= 2.1)
@@ -584,7 +559,6 @@ CHECKSUMS
bootsnap (1.26.1) sha256=5b5bd90f8f13ea338627c1d56ffbe2ea25e743ac48c2afec1a9bea3a06a264e2 bootsnap (1.26.1) sha256=5b5bd90f8f13ea338627c1d56ffbe2ea25e743ac48c2afec1a9bea3a06a264e2
brakeman (8.1.0) sha256=cfa9e5214e4925842f4bc849a64f8a7e6c5d0425fe98eac8d7b7bc60fdc17e07 brakeman (8.1.0) sha256=cfa9e5214e4925842f4bc849a64f8a7e6c5d0425fe98eac8d7b7bc60fdc17e07
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
capybara (3.40.0) sha256=42dba720578ea1ca65fd7a41d163dd368502c191804558f6e0f71b391054aeef
caxlsx (4.5.0) sha256=e3d98d859f148df05d5462086b5079b523f29c1766b569535f1d68629ce743ff caxlsx (4.5.0) sha256=e3d98d859f148df05d5462086b5079b523f29c1766b569535f1d68629ce743ff
chartkick (5.3.0) sha256=19a2bba39decf54c4939d3f31460535f8814c85045672ba2ed616c6897325b00 chartkick (5.3.0) sha256=19a2bba39decf54c4939d3f31460535f8814c85045672ba2ed616c6897325b00
chunky_png (1.4.0) sha256=89d5b31b55c0cf4da3cf89a2b4ebc3178d8abe8cbaf116a1dba95668502fdcfe chunky_png (1.4.0) sha256=89d5b31b55c0cf4da3cf89a2b4ebc3178d8abe8cbaf116a1dba95668502fdcfe
@@ -700,8 +674,6 @@ CHECKSUMS
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
rubyzip (3.7.0) sha256=65c19294da75297a939006f3516deacc33185fbd721ff1954f7a231db6d3e121 rubyzip (3.7.0) sha256=65c19294da75297a939006f3516deacc33185fbd721ff1954f7a231db6d3e121
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
selenium-webdriver (4.52.0) sha256=5d45ba100ea8b57f5a8c25979a636d48b4c60c39973478930d78e884bdeecd2d
solid_cable (4.1.0) sha256=828e3d509207b82b4f05f4e9c85f696994710679b52d511aa7f97ebd212d3226
solid_cache (1.0.10) sha256=bc05a2fb3ac78a6f43cbb5946679cf9db67dd30d22939ededc385cb93e120d41 solid_cache (1.0.10) sha256=bc05a2fb3ac78a6f43cbb5946679cf9db67dd30d22939ededc385cb93e120d41
solid_queue (1.7.2) sha256=a22685e1d2ee14ce7b4e5d4592c9d8e837951884c51555609dee58679ed03325 solid_queue (1.7.2) sha256=a22685e1d2ee14ce7b4e5d4592c9d8e837951884c51555609dee58679ed03325
sqlite3 (2.10.2-aarch64-linux-gnu) sha256=e9aea2c2b3476fc875dd8a89313a9a2862818519c0186bfb5b56d6f57bb08d98 sqlite3 (2.10.2-aarch64-linux-gnu) sha256=e9aea2c2b3476fc875dd8a89313a9a2862818519c0186bfb5b56d6f57bb08d98
@@ -743,10 +715,8 @@ CHECKSUMS
web-console (4.3.0) sha256=e13b71301cdfc2093f155b5aa3a622db80b4672d1f2f713119cc7ec7ac6a6da4 web-console (4.3.0) sha256=e13b71301cdfc2093f155b5aa3a622db80b4672d1f2f713119cc7ec7ac6a6da4
webfinger (2.1.3) sha256=567a52bde77fb38ca6b67e55db755f988766ec4651c1d24916a65aa70540695c webfinger (2.1.3) sha256=567a52bde77fb38ca6b67e55db755f988766ec4651c1d24916a65aa70540695c
webmock (3.34.0) sha256=72eed29dc8c00148d592acaedaaa6b869e2e397de57dfc8602b84aa834f46b33 webmock (3.34.0) sha256=72eed29dc8c00148d592acaedaaa6b869e2e397de57dfc8602b84aa834f46b33
websocket (1.2.11) sha256=b7e7a74e2410b5e85c25858b26b3322f29161e300935f70a0e0d3c35e0462737
websocket-driver (0.8.2) sha256=97c556b019bf3410b4961002ac501621e9322d3f8a7bc02161a09301cc4c4146 websocket-driver (0.8.2) sha256=97c556b019bf3410b4961002ac501621e9322d3f8a7bc02161a09301cc4c4146
websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241
xpath (3.2.0) sha256=6dfda79d91bb3b949b947ecc5919f042ef2f399b904013eb3ef6d20dd3a4082e
zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5 zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5
BUNDLED WITH BUNDLED WITH
+1 -1
View File
@@ -8,7 +8,7 @@ The port aims to be **easy to host**. It runs as one process with one SQLite dat
## Stack ## Stack
- Ruby 4.0, Rails 8.1, SQLite. Solid Queue, Solid Cache, and Solid Cable all use SQLite, so there are no extra services. Background jobs (nightly backup and records check, weekly reminders and AD search) run in the web process. - Ruby 4.0, Rails 8.1, SQLite. Solid Queue and Solid Cache both use SQLite, so there are no extra services. Background jobs (nightly backup and records check, weekly reminders and AD search) run in the web process.
- Hotwire (Turbo and Stimulus) with importmap, so there is no Node build step. Tailwind CSS 4 runs through `tailwindcss-rails`. - Hotwire (Turbo and Stimulus) with importmap, so there is no Node build step. Tailwind CSS 4 runs through `tailwindcss-rails`.
- Active Storage on local disk handles pictures, document pages, squawk attachments, and track logs. Identical files are stored once (hard links). - Active Storage on local disk handles pictures, document pages, squawk attachments, and track logs. Identical files are stored once (hard links).
- Chartkick and Chart.js draw the oil and fuel charts. - Chartkick and Chart.js draw the oil and fuel charts.
@@ -1,16 +0,0 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
set_current_user || reject_unauthorized_connection
end
private
def set_current_user
if session = Session.find_by(id: cookies.signed[:session_id])
self.current_user = session.user
end
end
end
end
-5
View File
@@ -21,11 +21,6 @@ module ApplicationHelper
title: Airworthiness::DISCLAIMER) title: Airworthiness::DISCLAIMER)
end end
def airworthiness_dot(status)
color = { "RED" => "bg-red-500", "LIMITED" => "bg-sky-500", "ORANGE" => "bg-amber-400", "GREEN" => "bg-emerald-500" }[status.status]
tag.span(class: "inline-block h-3 w-3 rounded-full #{color}", title: status.label)
end
# Badge class (or text class) for one airworthiness issue. # Badge class (or text class) for one airworthiness issue.
def issue_badge_class(issue) = "badge-#{AIRWORTHINESS_COLORS[issue.severity]}" def issue_badge_class(issue) = "badge-#{AIRWORTHINESS_COLORS[issue.severity]}"
@@ -6,8 +6,6 @@ const LABELS = { system: "System", light: "Light", dark: "Dark" }
// Light / dark / follow-the-OS theme toggle. The choice is kept in // Light / dark / follow-the-OS theme toggle. The choice is kept in
// localStorage; the layout's inline script applies it before first paint. // localStorage; the layout's inline script applies it before first paint.
export default class extends Controller { export default class extends Controller {
static targets = ["button"]
connect() { connect() {
this.media = window.matchMedia("(prefers-color-scheme: dark)") this.media = window.matchMedia("(prefers-color-scheme: dark)")
this.onSystemChange = () => { if (this.choice === "system") this.apply() } this.onSystemChange = () => { if (this.choice === "system") this.apply() }
-6
View File
@@ -30,12 +30,6 @@ class AirworthinessDirective < ApplicationRecord
find_by("upper(replace(name, ' ', '')) = ?", normalize_number(number).delete(" ")) find_by("upper(replace(name, ' ', '')) = ?", normalize_number(number).delete(" "))
end end
def self.applicable_to(aircraft)
direct = joins(:aircraft).where(aircraft: { id: aircraft.id }).select(:id)
via_component = joins(:components).where(components: { aircraft_id: aircraft.id }).select(:id)
where(id: direct).or(where(id: via_component))
end
def to_s = name def to_s = name
# [url, label] for this AD's document, when we have its link (DRS Excel # [url, label] for this AD's document, when we have its link (DRS Excel
-1
View File
@@ -1,5 +1,4 @@
class BackupRun < ApplicationRecord class BackupRun < ApplicationRecord
scope :latest_first, -> { order(created_at: :desc) } scope :latest_first, -> { order(created_at: :desc) }
def self.latest = latest_first.first def self.latest = latest_first.first
def self.last_good = where(ok: true).latest_first.first
end end
@@ -15,6 +15,15 @@ module SharedRecordHistory
before_destroy { linked_aircraft_ids.each { |id| history!(id, "destroy", attributes.except(*IGNORED)) } } before_destroy { linked_aircraft_ids.each { |id| history!(id, "destroy", attributes.except(*IGNORED)) } }
end end
class_methods do
# Records that apply to the aircraft directly, or to one of its components.
def applicable_to(aircraft)
direct = joins(:aircraft).where(aircraft: { id: aircraft.id }).select(:id)
via_component = joins(:components).where(components: { aircraft_id: aircraft.id }).select(:id)
where(id: direct).or(where(id: via_component))
end
end
# Aircraft this record applies to, directly or through a component. # Aircraft this record applies to, directly or through a component.
def linked_aircraft_ids = (aircraft_ids + components.map(&:aircraft_id)).compact.uniq def linked_aircraft_ids = (aircraft_ids + components.map(&:aircraft_id)).compact.uniq
-1
View File
@@ -26,7 +26,6 @@ class EntrySignature < ApplicationRecord
def imported? = origin.present? def imported? = origin.present?
def certificate_label = UserCertificate::SHORT_LABELS.fetch(certificate_kind, certificate_kind) def certificate_label = UserCertificate::SHORT_LABELS.fetch(certificate_kind, certificate_kind)
def short_id = content_digest.first(12)
def compute_seal def compute_seal
payload = [ logbook_entry_id, user_id, signer_name, certificate_kind, certificate_number, statement, payload = [ logbook_entry_id, user_id, signer_name, certificate_kind, certificate_number, statement,
-10
View File
@@ -28,15 +28,7 @@ class InspectionType < ApplicationRecord
scope :ordered, -> { order(:name) } scope :ordered, -> { order(:name) }
# Applies to the aircraft directly, or to one of its components.
def self.applicable_to(aircraft)
direct = joins(:aircraft).where(aircraft: { id: aircraft.id }).select(:id)
via_component = joins(:components).where(components: { aircraft_id: aircraft.id }).select(:id)
where(id: direct).or(where(id: via_component))
end
def to_s = name def to_s = name
def effect_label = EFFECTS[effect]
def limitation = LIMITATIONS[effect] def limitation = LIMITATIONS[effect]
def advisory? = effect == "advisory" def advisory? = effect == "advisory"
@@ -46,8 +38,6 @@ class InspectionType < ApplicationRecord
InspectionRecord.for_aircraft(aircraft).where(inspection_type_id: [ id, *satisfied_by.ids ]) InspectionRecord.for_aircraft(aircraft).where(inspection_type_id: [ id, *satisfied_by.ids ])
end end
def latest_record_for(aircraft) = records_for(aircraft).recent_first.first
def due_rule def due_rule
{ hours: recurring_hours.to_f, months: recurring_months, days: recurring_days } if recurring? { hours: recurring_hours.to_f, months: recurring_months, days: recurring_days } if recurring?
end end
-9
View File
@@ -33,13 +33,4 @@ module Sso
ENV["APP_URL"].presence&.chomp("/") || ENV["APP_URL"].presence&.chomp("/") ||
"#{ENV.fetch('FORCE_SSL', 'true') == 'true' ? 'https' : 'http'}://#{ENV.fetch('APP_HOST', 'localhost:3000')}" "#{ENV.fetch('FORCE_SSL', 'true') == 'true' ? 'https' : 'http'}://#{ENV.fetch('APP_HOST', 'localhost:3000')}"
end end
# Origin of the provider, for the CSP form-action list (the sign-in POST
# redirects there).
def issuer_origin
uri = URI.parse(ENV["OIDC_ISSUER"].to_s)
uri.host && "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
rescue URI::InvalidURIError
nil
end
end end
+2 -2
View File
@@ -3,14 +3,14 @@
class SystemInfo class SystemInfo
KEY_GEMS = %w[ KEY_GEMS = %w[
puma thruster propshaft importmap-rails turbo-rails stimulus-rails tailwindcss-rails tailwindcss-ruby puma thruster propshaft importmap-rails turbo-rails stimulus-rails tailwindcss-rails tailwindcss-ruby
solid_queue solid_cache solid_cable sqlite3 chartkick commonmarker anthropic solid_queue solid_cache sqlite3 chartkick commonmarker anthropic
omniauth omniauth_openid_connect rubyzip roo pdf-reader bcrypt omniauth omniauth_openid_connect rubyzip roo pdf-reader bcrypt
].freeze ].freeze
# Where the source lives; APP_REPOSITORY_URL overrides it for a fork. # Where the source lives; APP_REPOSITORY_URL overrides it for a fork.
REPOSITORY_URL = ENV["APP_REPOSITORY_URL"].presence || "https://github.com/rickbarrette/simple-aircraft-manager-rails" REPOSITORY_URL = ENV["APP_REPOSITORY_URL"].presence || "https://github.com/rickbarrette/simple-aircraft-manager-rails"
DATABASES = { "Main" => :primary, "Cache" => :cache, "Jobs" => :queue, "Cable" => :cable }.freeze DATABASES = { "Main" => :primary, "Cache" => :cache, "Jobs" => :queue }.freeze
# The release version, YYYY.MM.N (the repository's VERSION file). # The release version, YYYY.MM.N (the repository's VERSION file).
def version def version
-1
View File
@@ -27,7 +27,6 @@ class Airworthiness
def limited? = status == LIMITED def limited? = status == LIMITED
def orange? = status == ORANGE def orange? = status == ORANGE
def green? = status == GREEN def green? = status == GREEN
def can_fly? = !red?
def red_issues = issues.select { |i| i.severity == RED } def red_issues = issues.select { |i| i.severity == RED }
def limitations = issues.filter_map(&:limitation).uniq def limitations = issues.filter_map(&:limitation).uniq
+11 -48
View File
@@ -38,31 +38,9 @@ module Compliance
return Result.new(rank: OVERDUE) unless compliance return Result.new(rank: OVERDUE) unless compliance
return Result.new(rank: COMPLIANT) if compliance.closed? return Result.new(rank: COMPLIANT) if compliance.closed?
rank = COMPLIANT due_date = next_due(ad.due_rule, date: compliance.date_complied, hours: nil)[:date] if ad.recurring? && ad.recurring_calendar?
result = Result.new
due_hours = compliance.next_due_at_time.to_d due_hours = compliance.next_due_at_time.to_d
if due_hours > 0 due_result(due_date, (due_hours if due_hours.positive?), current_hours, today)
result.next_due_hours = due_hours
if current_hours >= due_hours
rank = OVERDUE
elsif current_hours + Airworthiness::HOURS_WARNING >= due_hours
rank = [ rank, DUE_SOON ].max
end
end
if ad.recurring? && ad.recurring_calendar?
due = next_due(ad.due_rule, date: compliance.date_complied, hours: nil)[:date]
result.next_due_date = due
if today > due
rank = OVERDUE
elsif today + Airworthiness::DAYS_WARNING >= due
rank = [ rank, DUE_SOON ].max
end
end
result.rank = rank
result
end end
# `records` are those that count for the type (InspectionType#records_for). # `records` are those that count for the type (InspectionType#records_for).
@@ -77,32 +55,17 @@ module Compliance
return Result.new(rank: OVERDUE) unless last_record return Result.new(rank: OVERDUE) unless last_record
return Result.new(rank: COMPLIANT) unless type.recurring? return Result.new(rank: COMPLIANT) unless type.recurring?
rank = COMPLIANT due_date = next_due(type.due_rule, date: last_record.date, hours: nil)[:date]
result = Result.new due_result(due_date, next_due_hours(type, records), current_hours, today)
if type.recurring_months.positive? || type.recurring_days.positive?
due = last_record.date
due = end_of_month_after(due, type.recurring_months) if type.recurring_months.positive?
due += type.recurring_days.days if type.recurring_days.positive?
result.next_due_date = due
if today > due
rank = OVERDUE
elsif today + Airworthiness::DAYS_WARNING >= due
rank = [ rank, DUE_SOON ].max
end
end end
if (due_hours = next_due_hours(type, records)) # Overdue once the date has passed or the hours are reached; due soon
result.next_due_hours = due_hours # within the warning window of either.
if current_hours >= due_hours def due_result(due_date, due_hours, current_hours, today)
rank = OVERDUE overdue = (due_date && today > due_date) || (due_hours && current_hours >= due_hours)
elsif current_hours + Airworthiness::HOURS_WARNING >= due_hours soon = (due_date && today + Airworthiness::DAYS_WARNING >= due_date) ||
rank = [ rank, DUE_SOON ].max (due_hours && current_hours + Airworthiness::HOURS_WARNING >= due_hours)
end Result.new(rank: overdue ? OVERDUE : (soon ? DUE_SOON : COMPLIANT), next_due_date: due_date, next_due_hours: due_hours)
end
result.rank = rank
result
end end
def next_due_hours(type, records) def next_due_hours(type, records)
-1
View File
@@ -24,7 +24,6 @@ class FlightStats
def total_fuel = @fuel.sum { _2.to_f }.round(1) def total_fuel = @fuel.sum { _2.to_f }.round(1)
def average_flight = count.zero? ? nil : (total_flight / count).round(1) def average_flight = count.zero? ? nil : (total_flight / count).round(1)
def shortest_flight = @flights.map { flight_hours(_1) }.min&.round(1)
def longest_flight = @flights.map { flight_hours(_1) }.max&.round(1) def longest_flight = @flights.map { flight_hours(_1) }.max&.round(1)
# Gallons per tach hour over all fuel records. # Gallons per tach hour over all fuel records.
+1 -1
View File
@@ -1,5 +1,5 @@
<%# Cycles System → Light → Dark. Icons are swapped by theme_controller.js. %> <%# Cycles System → Light → Dark. Icons are swapped by theme_controller.js. %>
<button type="button" data-controller="theme" data-action="theme#cycle" data-theme-target="button" <button type="button" data-controller="theme" data-action="theme#cycle"
class="rounded p-1 text-white/80 hover:bg-white/10 hover:text-white" title="Theme: System" aria-label="Theme: System"> class="rounded p-1 text-white/80 hover:bg-white/10 hover:text-white" title="Theme: System" aria-label="Theme: System">
<svg data-theme-icon="system" class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg> <svg data-theme-icon="system" class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>
<svg data-theme-icon="light" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg> <svg data-theme-icon="light" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
+2 -10
View File
@@ -1,7 +1,4 @@
# Async adapter only works within the same process, so for manually triggering cable updates from a console, # Nothing in the app uses Action Cable, so it runs in-process with no database.
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
# to make the web console appear.
development: development:
adapter: async adapter: async
@@ -9,9 +6,4 @@ test:
adapter: test adapter: test
production: production:
adapter: solid_cable adapter: async
connects_to:
database:
writing: cable
polling_interval: 0.1.seconds
message_retention: 1.day
-4
View File
@@ -35,7 +35,3 @@ production:
<<: *default <<: *default
database: storage/production_queue.sqlite3 database: storage/production_queue.sqlite3
migrations_paths: db/queue_migrate migrations_paths: db/queue_migrate
cable:
<<: *default
database: storage/production_cable.sqlite3
migrations_paths: db/cable_migrate
+2 -2
View File
@@ -3,7 +3,7 @@ Rails.application.routes.draw do
# (overrides Active Storage's open endpoint at the same path). # (overrides Active Storage's open endpoint at the same path).
post "rails/active_storage/direct_uploads", to: "direct_uploads#create" post "rails/active_storage/direct_uploads", to: "direct_uploads#create"
resource :session do resource :session, only: %i[new create destroy] do
get :two_factor get :two_factor
post :two_factor, action: :verify_two_factor post :two_factor, action: :verify_two_factor
end end
@@ -18,7 +18,7 @@ Rails.application.routes.draw do
get "auth/failure", to: "sso#failure" get "auth/failure", to: "sso#failure"
delete "profile/sso", to: "sso#destroy", as: :sso_link delete "profile/sso", to: "sso#destroy", as: :sso_link
delete "profile/sessions", to: "profiles#sign_out_others", as: :other_sessions delete "profile/sessions", to: "profiles#sign_out_others", as: :other_sessions
resources :passwords, param: :token resources :passwords, param: :token, only: %i[new create edit update]
resource :setup, only: %i[new create], controller: "setup" resource :setup, only: %i[new create], controller: "setup"
resource :profile, only: %i[edit update] resource :profile, only: %i[edit update]
resources :certificates, path: "profile/certificates", controller: "user_certificates", only: %i[create update destroy] resources :certificates, path: "profile/certificates", controller: "user_certificates", only: %i[create update destroy]
-11
View File
@@ -1,11 +0,0 @@
ActiveRecord::Schema[7.1].define(version: 1) do
create_table "solid_cable_messages", force: :cascade do |t|
t.binary "channel", limit: 1024, null: false
t.binary "payload", limit: 536870912, null: false
t.datetime "created_at", null: false
t.integer "channel_hash", limit: 8, null: false
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
end
end
-5
View File
@@ -1,5 +0,0 @@
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
end
+1 -1
View File
@@ -37,7 +37,7 @@ class FlightStatsTest < ActiveSupport::TestCase
s = stats s = stats
assert_equal 3, s.count assert_equal 3, s.count
assert_equal 1.8, s.average_flight assert_equal 1.8, s.average_flight
assert_equal [ 0.6, 3.5 ], [ s.shortest_flight, s.longest_flight ] assert_equal 3.5, s.longest_flight
assert_equal 3, s.airports_visited assert_equal 3, s.airports_visited
assert_equal [ "KOQU", 3 ], s.top_airports.first assert_equal [ "KOQU", 3 ], s.top_airports.first
+3 -2
View File
@@ -16,7 +16,8 @@ class InspectionRulesTest < ActiveSupport::TestCase
xpdr = type("Transponder (91.413)", recurring_months: 24, effect: "no_transponder") xpdr = type("Transponder (91.413)", recurring_months: 24, effect: "no_transponder")
done(xpdr, 3.years.ago.to_date) done(xpdr, 3.years.ago.to_date)
aw = @a.reload.airworthiness aw = @a.reload.airworthiness
assert [ aw.limited?, aw.can_fly? ].all? assert aw.limited?
assert_not aw.red?
assert_equal "No transponder", aw.label assert_equal "No transponder", aw.label
assert_equal "LIMITED", aw.issues.sole.severity assert_equal "LIMITED", aw.issues.sole.severity
@@ -30,7 +31,7 @@ class InspectionRulesTest < ActiveSupport::TestCase
annual = type("Annual", recurring_months: 12) annual = type("Annual", recurring_months: 12)
done(annual, 13.months.ago.to_date) done(annual, 13.months.ago.to_date)
aw = @a.reload.airworthiness aw = @a.reload.airworthiness
assert_equal [ "RED", "Grounded", false ], [ aw.status, aw.label, aw.can_fly? ] assert_equal [ "RED", "Grounded" ], [ aw.status, aw.label ]
assert_raises(AircraftGroundedError) { HoursService.new(@a).enforce_airworthiness! } assert_raises(AircraftGroundedError) { HoursService.new(@a).enforce_airworthiness! }
end end
View File
Whitespace-only changes.