record errors and decode existing vins on migration

This commit is contained in:
2026-03-26 07:51:38 -04:00
parent 8503c48944
commit c38bced329
4 changed files with 69 additions and 15 deletions

View File

@@ -76,10 +76,20 @@ class VehiclesController < ApplicationController
end
end
# used by the polling JS in vehicle#show
def status
vehicle = Vehicle.find(params[:id])
# decode the vin if it hasn't been done for some reason
unless vehicle.vin_decoded
if vehicle.error.nil?
VehicleVinDecodeJob.perform_later(vehicle)
end
end
render json: {
decoded: vehicle.vin_decoded
decoded: vehicle.vin_decoded,
error: vehicle.error
}
end