Compare commits

...

3 Commits

Author SHA1 Message Date
ricky e0fc07141c 2026.2.8 2026-02-25 22:13:18 -05:00
ricky 3e6c2672e0 removed duplicate comment 2026-02-25 22:12:48 -05:00
ricky 71bde3a249 Enhance search_result_ranks_and_ids method to rank results by ID and streamline query handling 2026-02-25 22:12:14 -05:00
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -92,14 +92,11 @@ class Vehicle < ActiveRecord::Base
scope = self.all
tokens.each do |token|
q = "%#{sanitize_sql_like(token)}%"
scope = where("vin LIKE ? OR make LIKE ? OR model LIKE ? OR year LIKE ?", "%#{q}%", "%#{q}%", "%#{q}%", "%#{q}%")
scope = scope.search(token)
end
ids = scope.distinct.limit(options[:limit] || 100).pluck(:id)
# rank by id
ids.each_with_object({}) { |id, h| h[id] = id }
ids.index_with { |id| id }
end
# returns a human readable string
+1 -1
View File
@@ -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.2.7'
version '2026.2.8'
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '6.1.0'