From a69fda5ead6e5b07dc850d65f83706e4c07f20e0 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 30 Nov 2022 02:51:58 -0800 Subject: [PATCH] Small refactor of handling groups Using the `filters` key so we can hook into existing search infrastructure on the frontend --- app/controllers/api/v1/search_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb index 1701b51..dcf4013 100644 --- a/app/controllers/api/v1/search_controller.rb +++ b/app/controllers/api/v1/search_controller.rb @@ -82,11 +82,12 @@ class Api::V1::SearchController < Api::V1::ApiController # Set up basic parameters we'll use job = Job.find(search_params[:job]) locale = search_params[:locale] || 'en' - group = search_params[:group].to_i unless !search_params[:group].present? # Set the conditions based on the group requested conditions = {} - if (group) + if search_params[:filters].present? && search_params[:filters]["group"].present? + group = search_params[:filters]["group"].to_i + if (group < 4) conditions[:color] = group conditions[:emp] = false