diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index ea69339..fbfa481 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -31,7 +31,7 @@ class RecruitmentsController < PseudoSessionController candidates = EmployeeProfile.job_seekers end if !candidates.nil? && !candidates.is_a?(Array) - candidates = candidates.desc(:updated_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) + candidates = candidates.job_seekers.desc(:updated_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) total_pages = candidates.total_pages else candidates = [] @@ -693,6 +693,25 @@ class RecruitmentsController < PseudoSessionController end def filter_candidates + candidates = [] + keywords = params[:q].split(",").collect{|s| /#{s.strip}/i} + names = RecruitProfile.any_of({:first_name.in => keywords}, {:last_name.in => keywords}).pluck(:id) + designations = EmployerProfile.where(:desired_job_title.in => keywords) + skills = EmployerProfile.where(:skills.in => keywords) + query = [] + if names.count > 0 + query << {:recruit_profile_id.in => names} + end + if skills.count > 0 + query << {:skills.in => keywords} + end + if designations.count > 0 + query << {:desired_job_title.in => keywords} + end + if !query.empty? + candidates = EmployerProfile.any_of(query) + end + candidates end def advanced_filter_candidates diff --git a/app/views/recruitments/_employee_dashboard.html.erb b/app/views/recruitments/_employee_dashboard.html.erb index 836b8b3..6d1e985 100644 --- a/app/views/recruitments/_employee_dashboard.html.erb +++ b/app/views/recruitments/_employee_dashboard.html.erb @@ -9,7 +9,7 @@
<% if @applications.blank? %> -