Skip to content

Commit

Permalink
Update vacancies controller campaign action
Browse files Browse the repository at this point in the history
Better to use `ActiveModel::Type::Boolean.new.cast(value)` to catch more
truthy values
  • Loading branch information
ddippolito committed Oct 8, 2024
1 parent 699fde2 commit 61f59d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/vacancies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def campaign_search_params
campaign_params[:subjects] = [campaign_params.delete(:email_subject)].compact
campaign_params[:phases] = [campaign_params.delete(:email_phase)].compact
working_patterns = []
working_patterns << "full_time" if campaign_params.delete(:email_fulltime) == "true"
working_patterns << "part_time" if campaign_params.delete(:email_parttime) == "true"
working_patterns << "job_share" if campaign_params.delete(:email_jobshare) == "true"
working_patterns << "full_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_fulltime)) == "true"
working_patterns << "part_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_parttime)) == "true"
working_patterns << "job_share" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_jobshare)) == "true"
campaign_params[:working_patterns] = working_patterns
campaign_params[:ect_statuses] = [campaign_params.delete(:email_ECT)].compact
end
Expand Down

0 comments on commit 61f59d7

Please sign in to comment.