Skip to content

Commit

Permalink
Set Choice#placement_school_auto_selected for Provider#selectable_school
Browse files Browse the repository at this point in the history
  When a Candidate chooses a course from a provider that has
  `selectable_school` set to false, we need to record that that
  candidate did not have the option to choose the placement school.
  • Loading branch information
inulty-dfe committed Aug 29, 2024
1 parent 819b70e commit 3fab9c5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def study_mode_row
end

def location_row
return if application_choice.school_placement_auto_selected?

{
key: 'Location',
value: current_course_option.site_name,
Expand Down
8 changes: 6 additions & 2 deletions app/services/candidate_interface/course_selection_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ def available_course_options
end

def save_application_choice(choice)
choice.tap do
choice.configure_initial_course_choice!(course_option)
choice.tap do |c|
c.configure_initial_course_choice!(course_option)

if choice.provider
choice.update(school_placement_auto_selected: !choice.provider.selectable_school?)
end
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/application_choice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
)
end

school_placement_auto_selected { false }

current_recruitment_cycle_year { recruitment_cycle_year || course_option.course.recruitment_cycle_year }
personal_statement { Faker::Lorem.paragraph_by_chars(number: 50) }
original_course_option { course_option }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
when_i_select_the_single_site_full_time_course
and_i_visit_my_course_choices_page
then_the_site_is_resolved_automatically_and_i_see_the_course_choice
and_the_application_is_not_school_placement_auto_selected
end

def given_i_am_signed_in
Expand Down Expand Up @@ -154,4 +155,8 @@ def application_choice
def then_i_see_the_provider_name_in_caption
expect(page.first('.govuk-caption-xl').text).to eq('University of Alien Dance')
end

def and_the_application_is_not_school_placement_auto_selected
expect(page).to have_content('Location')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
and_i_choose_a_course

then_i_am_on_the_application_choice_review_page
and_the_application_is_school_placement_auto_selected
end

def given_i_am_signed_in
Expand Down Expand Up @@ -90,4 +91,8 @@ def and_there_are_course_options
create(:course_option, site: first_site, course: @multi_site_course)
create(:course_option, site: second_site, course: @multi_site_course)
end

def and_the_application_is_school_placement_auto_selected
expect(page).to have_no_content('Location')
end
end

0 comments on commit 3fab9c5

Please sign in to comment.