Skip to content

Commit d640455

Browse files
authored
Merge pull request #5566 from nhsuk/hide-year-groups
Hide year groups in clinic sessions
2 parents 7462d4b + 4e359a9 commit d640455

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

app/models/draft_session.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ def patient_is_catch_up?(patient, programmes:)
189189

190190
def dates = session_dates.map(&:value).compact.sort.uniq
191191

192+
def can_change_year_groups? = school? && !editing?
193+
192194
def set_notification_dates
193195
if earliest_date
194196
if generic_clinic?

app/views/draft_sessions/confirm.html.erb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
row.with_action(text: "Change", href: draft_session_path("programmes"), visually_hidden_text: "programmes")
2828
end
2929

30-
summary_list.with_row do |row|
31-
row.with_key { "Year groups" }
32-
row.with_value { format_year_groups(@draft_session.year_groups) }
30+
if @draft_session.school?
31+
summary_list.with_row do |row|
32+
row.with_key { "Year groups" }
33+
row.with_value { format_year_groups(@draft_session.year_groups) }
3334

34-
unless @draft_session.editing?
35-
row.with_action(text: "Change", href: draft_session_path("year-groups"), visually_hidden_text: "year groups")
35+
if @draft_session.can_change_year_groups?
36+
row.with_action(text: "Change", href: draft_session_path("year-groups"), visually_hidden_text: "year groups")
37+
end
3638
end
3739
end
3840

spec/features/sessions_clinic_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def and_i_choose_the_dates
177177

178178
def then_i_see_the_confirmation_page
179179
expect(page).to have_content("Check and confirm")
180+
expect(page).not_to have_content("Year groups")
180181
expect(page).to have_content("InvitationsSend on Sunday, 18 February 2024")
181182
end
182183

spec/features/sessions_school_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ def when_i_choose_the_dates
295295

296296
def then_i_see_the_confirmation_page
297297
expect(page).to have_content("Check and confirm")
298+
expect(page).to have_content("Year groupsYears 8 to 11")
299+
expect(page).to have_link("Change year groups")
298300
expect(page).to have_content("Register attendanceYes")
299301
end
300302

0 commit comments

Comments
 (0)