3 Commits

Author SHA1 Message Date
f9102c1a5d update vehicles in batches 2026-03-26 22:10:32 -04:00
0aef1d0c2b Build vehicle name 2026-03-26 12:45:17 -04:00
ba313dfd02 2026.3.3 2026-03-26 08:11:43 -04:00
3 changed files with 15 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ class VehicleVinDecodeJob < ApplicationJob
model: details.model.presence || vehicle.model, model: details.model.presence || vehicle.model,
doors: details.doors.presence || vehicle.doors, doors: details.doors.presence || vehicle.doors,
trim: details.trim.presence || vehicle.trim, trim: details.trim.presence || vehicle.trim,
name: vehicle.to_s, name: build_name(vehicle, details),
vin_decoded: true, vin_decoded: true,
error: nil error: nil
) )
@@ -40,6 +40,15 @@ class VehicleVinDecodeJob < ApplicationJob
private private
def build_name(vehicle, details)
if details.year && details.make && details.model
suffix = vehicle.vin.to_s[9..]
"#{details.year} #{details.make} #{details.model} - #{suffix}"
else
vehicle.vin
end
end
def log(msg) def log(msg)
Rails.logger.info "[VehicleVinDecodeJob] #{msg}" Rails.logger.info "[VehicleVinDecodeJob] #{msg}"
end end

View File

@@ -19,8 +19,10 @@ class AddPollingAndIndexes < ActiveRecord::Migration[7.0]
add_index :vehicles, :model add_index :vehicles, :model
add_index :vehicles, :year add_index :vehicles, :year
Vehicle.all.each do |v| Vehicle.find_each.with_index do |vehicle, index|
VehicleVinDecodeJob.perform_later(v.id) VehicleVinDecodeJob
.set(wait: (index / 50).minutes)
.perform_later(vehicle.id)
end end
end end

View File

@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
name 'Redmine QBO Vehicles plugin' name 'Redmine QBO Vehicles plugin'
author 'Rick Barrette' author 'Rick Barrette'
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking' description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
version '2026.3.2' version '2026.3.3'
url 'https://github.com/rickbarrette/redmine_qbo_vehicles' url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
author_url 'https://barrettefabrication.com' author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '6.1.0' requires_redmine version_or_higher: '6.1.0'