Finished phase006
CI / scan_ruby (push) Failing after 7s
CI / scan_js (push) Failing after 7s
CI / lint (push) Failing after 8s

This commit is contained in:
2026-09-16 16:37:03 -06:00
parent 0826d267f2
commit 87d2141ed0
22 changed files with 754 additions and 10 deletions
+2 -2
View File
@@ -20,9 +20,9 @@ class MaintenanceEntry < ApplicationRecord
return if vehicle.blank? || name.blank?
scheduled = vehicle.maintenance_schedules.any? do |schedule|
schedule.maintenance_type.casecmp?(name)
schedule.active? && schedule.maintenance_type.casecmp?(name)
end
scheduled ||= vehicle.maintenance_schedules.where("lower(maintenance_type) = ?", name.downcase).exists? if vehicle.persisted?
scheduled ||= vehicle.maintenance_schedules.active.where("lower(maintenance_type) = ?", name.downcase).exists? if vehicle.persisted?
return if scheduled
errors.add(:name, "must match a maintenance schedule for the vehicle")