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:
parent
c0bdb47d43
commit
a69fda5ead
1 changed files with 3 additions and 2 deletions
|
|
@ -82,11 +82,12 @@ class Api::V1::SearchController < Api::V1::ApiController
|
||||||
# Set up basic parameters we'll use
|
# Set up basic parameters we'll use
|
||||||
job = Job.find(search_params[:job])
|
job = Job.find(search_params[:job])
|
||||||
locale = search_params[:locale] || 'en'
|
locale = search_params[:locale] || 'en'
|
||||||
group = search_params[:group].to_i unless !search_params[:group].present?
|
|
||||||
|
|
||||||
# Set the conditions based on the group requested
|
# Set the conditions based on the group requested
|
||||||
conditions = {}
|
conditions = {}
|
||||||
if (group)
|
if search_params[:filters].present? && search_params[:filters]["group"].present?
|
||||||
|
group = search_params[:filters]["group"].to_i
|
||||||
|
|
||||||
if (group < 4)
|
if (group < 4)
|
||||||
conditions[:color] = group
|
conditions[:color] = group
|
||||||
conditions[:emp] = false
|
conditions[:emp] = false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue