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,
|
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
2
init.rb
2
init.rb
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user