Small refactor of handling groups

Using the `filters` key so we can hook into existing search infrastructure on the frontend
This commit is contained in:
Justin Edmund 2022-11-30 02:51:58 -08:00
parent c0bdb47d43
commit a69fda5ead

View file

@ -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