From 158786b5a8ce3bb5163ad79581eeb316074e6f76 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 5 Feb 2023 16:32:57 -0800 Subject: [PATCH] Show EMP skills for Row 5 classes Row 4 EMP skills were not showing up, so you couldn't set Rage IV on Viking, for example --- app/controllers/api/v1/search_controller.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb index 9792109..336704f 100644 --- a/app/controllers/api/v1/search_controller.rb +++ b/app/controllers/api/v1/search_controller.rb @@ -140,17 +140,27 @@ module Api # Perform the query skills = if search_params[:query].present? && search_params[:query].length >= 2 - JobSkill.method("#{locale}_search").call(search_params[:query]) + JobSkill.joins(:job) + .method("#{locale}_search").call(search_params[:query]) .where(conditions) .where(job: job.id, main: false) .or( - JobSkill.method("#{locale}_search").call(search_params[:query]) + JobSkill.joins(:job) + .method("#{locale}_search").call(search_params[:query]) .where(conditions) .where(sub: true) .where.not(job: job.id) ) + .or( + JobSkill.joins(:job) + .method("#{locale}_search").call(search_params[:query]) + .where(conditions) + .where(job: { base_job: job.base_job.id }, emp: true) + .where.not(job: job.id) + ) else JobSkill.all + .joins(:job) .where(conditions) .where(job: job.id, main: false) .or( @@ -165,6 +175,13 @@ module Api .where(job: job.base_job.id, base: true) .where.not(job: job.id) ) + .or( + JobSkill.all + .where(conditions) + .joins(:job) + .where(job: { base_job: job.base_job.id }, emp: true) + .where.not(job: job.id) + ) end count = skills.length