Skip to content

Commit

Permalink
Merge pull request #6749 from DFE-Digital/reinstate_legacy_job_roles_…
Browse files Browse the repository at this point in the history
…for_subscriptions

Temporarily allow legacy job role in job alerts
  • Loading branch information
ddippolito committed Mar 21, 2024
2 parents f98ea22 + 02c3132 commit d1f5055
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/presenters/subscription_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SubscriptionPresenter < BasePresenter
SEARCH_CRITERIA_SORT_ORDER = %w[organisation_slug
keyword
location
job_roles
teaching_job_roles
teaching_support_job_roles
non_teaching_support_job_roles
Expand Down Expand Up @@ -50,6 +51,8 @@ def search_criteria_field(field, value)

def job_roles_filter(field, value)
case field
when "job_roles"
render_legacy_job_roles_filter(value)
when "teaching_job_roles"
render_teaching_job_roles_filter(value)
when "teaching_support_job_roles"
Expand All @@ -71,6 +74,10 @@ def render_location_filter(location, radius)
end
end

def render_legacy_job_roles_filter(value)
{ job_role: value.map { |role| I18n.t("helpers.label.publishers_job_listing_job_role_form.job_role_options.#{role}") }.join(", ") }
end

def render_teaching_job_roles_filter(value)
{ teaching_job_roles: value.map { |role| I18n.t("helpers.label.publishers_job_listing_job_role_form.job_role_options.#{role}") }.join(", ") }
end
Expand Down
4 changes: 4 additions & 0 deletions spec/presenters/subscription_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
phases: %w[secondary sixth_form_or_college],
organisation_slug: organisation.slug,
radius: "10",
job_roles: %w[headteacher head_of_year_or_phase],
teaching_job_roles: %w[headteacher head_of_year_or_phase],
teaching_support_job_roles: %w[teaching_assistant],
non_teaching_support_job_roles: %w[it_support],
Expand All @@ -119,6 +120,7 @@
organisation_type_basic(organisation).titleize,
"keyword",
"location",
"job_role",
"teaching_job_roles",
"teaching_support_job_roles",
"non_teaching_support_job_roles",
Expand All @@ -140,6 +142,7 @@
something_else: "testing",
phases: %w[secondary sixth_form_or_college],
organisation_slug: organisation.slug,
job_roles: %w[headteacher head_of_year_or_phase],
teaching_job_roles: %w[headteacher head_of_year_or_phase],
teaching_support_job_roles: %w[teaching_assistant],
non_teaching_support_job_roles: %w[it_support],
Expand All @@ -155,6 +158,7 @@
organisation_type_basic(organisation).titleize,
"keyword",
"location",
"job_role",
"teaching_job_roles",
"teaching_support_job_roles",
"non_teaching_support_job_roles",
Expand Down

0 comments on commit d1f5055

Please sign in to comment.