mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-04-02 15:11:58 -04:00
Compare commits
3 Commits
dev
...
f9102c1a5d
| Author | SHA1 | Date | |
|---|---|---|---|
| f9102c1a5d | |||
| 0aef1d0c2b | |||
| ba313dfd02 |
@@ -32,7 +32,7 @@ class VehicleVinDecodeJob < ApplicationJob
|
||||
model: details.model.presence || vehicle.model,
|
||||
doors: details.doors.presence || vehicle.doors,
|
||||
trim: details.trim.presence || vehicle.trim,
|
||||
name: vehicle.to_s,
|
||||
name: build_name(vehicle, details),
|
||||
vin_decoded: true,
|
||||
error: nil
|
||||
)
|
||||
@@ -40,6 +40,15 @@ class VehicleVinDecodeJob < ApplicationJob
|
||||
|
||||
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)
|
||||
Rails.logger.info "[VehicleVinDecodeJob] #{msg}"
|
||||
end
|
||||
|
||||
@@ -19,8 +19,10 @@ class AddPollingAndIndexes < ActiveRecord::Migration[7.0]
|
||||
add_index :vehicles, :model
|
||||
add_index :vehicles, :year
|
||||
|
||||
Vehicle.all.each do |v|
|
||||
VehicleVinDecodeJob.perform_later(v.id)
|
||||
Vehicle.find_each.with_index do |vehicle, index|
|
||||
VehicleVinDecodeJob
|
||||
.set(wait: (index / 50).minutes)
|
||||
.perform_later(vehicle.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
2
init.rb
2
init.rb
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
|
||||
name 'Redmine QBO Vehicles plugin'
|
||||
author 'Rick Barrette'
|
||||
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'
|
||||
author_url 'https://barrettefabrication.com'
|
||||
requires_redmine version_or_higher: '6.1.0'
|
||||
|
||||
Reference in New Issue
Block a user